Guest User

Untitled

a guest
Oct 18th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. query = "select relname, pg_total_relation_size(oid) as size from pg_class where relname like 'f.%." + match.group(1) + "[%]' order by relname asc"
  2. cursor.execute( query )
  3. records = cursor.fetchall()
  4. # item[0] - relation name, item[1] - relation size
  5. for item in records:
  6.     size = round(float(item[1])/1024/1024, 2)
  7.     query2 = 'select max(id) as id from "' + item[0] + '"';
  8.     cursor.execute( query2 )
  9.     records2 = cursor.fetchall()
  10.     for item2 in records2:
  11.         print item2
Add Comment
Please, Sign In to add comment