select table_name, pg_relation_size(quote_ident(table_name))
from information_schema.tables
where table_schema = 'public'
order by 2
这将显示模式public
中所有表的大小.如果有多个模式,则可能需要使用:
select table_schema, table_name, pg_relation_size('"'||table_schema||'"."'||table_name||'"')
from information_schema.tables
order by 3
SQLFiddle示例:http://sqlfiddle.com/#!15/13157/3
manual中所有对象大小函数的列表.