postgresql 查看数据库、表的大小
查看数据库的大小 select pg_database_size('test'); select pg_size_pretty(pg_database_size('test');
查看单索引大小
elect pg_relation_size('idx_id'); select pg_size_pretty(pg_relation_size('idx_id'); 查看表中所有索引大小
select pg_indexes_size('user');
select pg_size_pretty(pg_indexes_size('user'));
使用pg_table_size() 函数查看
select pg_table_size('user');
select pg_size_pretty(pg_table_size('user'));
查看表大小同pg_table_size()
select pg_relation_size('user');
select pg_size_pretty(pg_relation_size('user'));
查看表总大小
select pg_total_relation_size('user'); select pg_size_pretty(pg_total_relation_size('user'));
参考
https://www.cnblogs.com/mchina/archive/2013/04/19/3028573.html