-- 远程连接 psql -U kong -p 5432 -h 10.0.0.10 -w -- 所有数据库大小 select datname,pg_size_pretty(pg_database_size(datname)) from pg_database; -- 查看指定数据库大小 select pg_size_pretty(pg_database_size('app01')); -- 表大小 select pg_size_pretty(pg_relation_size('t1')); -- 表和索引大小 select pg_size_pretty(pg_total_relation_size('t1')); -- 查看数据分布情况和磁盘空间 select dfhostname,dfspace,dfdevice from gp_toolkit.gp_disk_free order by dfhostname;