select pg_size_pretty(pg_tablespace_size('pg_default'));
select pg_size_pretty(pg_relation_size('account_move_line'));
select sum(t.size) from (
SELECT table_schema || '.' || table_name AS table_full_name, pg_total_relation_size('"' || table_schema || '"."' || table_name || '"')AS size
FROM information_schema.tables
ORDER BY
pg_total_relation_size('"' || table_schema || '"."' || table_name || '"') DESC
) t;
SELECT table_schema || '.' || table_name AS table_full_name, pg_size_pretty(pg_total_relation_size('"' || table_schema || '"."' || table_name || '"'))AS size
FROM information_schema.tables
ORDER BY
pg_total_relation_size('"' || table_schema || '"."' || table_name || '"') DESC;
标签:postgresql,name,表格,占用,relation,pg,table,schema,size
From: https://www.cnblogs.com/qianxunman/p/17679546.html