2018-07-17

2019-01-17  本文已影响0人  天地一蜉蝣_6e86

postgre 查看表所占空间大小

方法一 ,查一个表

select pg_size_pretty(pg_relation_size('table_name'));

1

方法二 ,查出所有表并按大小排序

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 limit 200

上一篇下一篇

猜你喜欢

热点阅读