赞
踩
SELECT pg_size_pretty(pg_database_size('postgres'));
SELECT pg_size_pretty(pg_relation_size('table_test'));
SELECT pg_size_pretty(pg_relation_size('table_test_pkey'));
SELECT pg_size_pretty(pg_tablespace_size('pg_default'));
SELECT pg_size_pretty(pg_total_relation_size(cast('text_table' as text)));
select
tablename,
pg_size_pretty(size)
from
(select
tablename,
pg_total_relation_size(cast(tablename as text)) as size
from pg_tables
where schemaname = 'public' -- 指定schema
) as tmp
order by size desc limit 30;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。