美文网首页
2018-07-17

2018-07-17

作者: 天地一蜉蝣_6e86 | 来源:发表于2019-01-17 11:00 被阅读0次

    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

    相关文章

      网友评论

          本文标题:2018-07-17

          本文链接:https://www.haomeiwen.com/subject/ctngpftx.html