--查看数据库大小,不计算索引selectpg_size_pretty(pg_database_size('mydb')); --查看数据库大小,包含索引selectpg_size_pretty(pg_total_size('mydb')); --查看表中索引大小selectpg_size_pretty(pg_indexes_size('test_1')); --查看表大小,不包括索引selectpg_size_pretty(pg_relation_size('test_...
统计数据库中各表占用磁盘大小: 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...
统计各数据库占用磁盘大小: 代码语言:javascript 复制 SELECTd.datnameASName,pg_catalog.pg_get_userbyid(d.datdba)ASOwner,CASEWHENpg_catalog.has_database_privilege(d.datname,'CONNECT')THENpg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))ELSE'No Access'ENDASSIZEFROMpg_catalog.pg...