postgresql查询表的大小

postgresql查询表的大小

 

一、查询sql

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 20;

 

二、结果展示

 

 

~~~ 完美!

posted @ 2021-06-18 14:16  BillyYang  阅读(304)  评论(0编辑  收藏  举报