postgresql 查看表格占用空间
http://www.linuxmysql.com/14/2022/1182.htm
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;
懂得,原来世界如此简单!