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;

二、结果展示

~~~ 完美!