罗名岳
发布于

查看当前库所有表大小

SELECT n.nspname AS schemaname, c.relname AS tablename, 
pg_size_pretty(pg_relation_size(n.nspname||'.'||c.relname))  size
 FROM pg_class c
   LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
   LEFT JOIN pg_tablespace t ON t.oid = c.reltablespace
  WHERE c.relkind = 'r'::"char" and c.relfilenode not in (select reloid from pg_exttable );
评论
    test