postgres数据库 查看数据表大小
postgres数据库 查看数据表大小
·
1 查看某个数据库大小
select pg_database_size('【数据库名】');
2 查看多个数据库大小
select pg_database.datname,
pg_size_pretty (pg_database_size(pg_database.datname))
AS size
from pg_database;
3 按顺序查看索引
select indexrelname, pg_size_pretty(pg_relation_size(relid))
from pg_stat_user_indexes
where schemaname='public'
order by pg_relation_size(relid) desc;
4 查看所有表的大小
select relname, pg_size_pretty(pg_relation_size(relid))
from pg_stat_user_tables
where schemaname='public'
order by pg_relation_size(relid) desc;
5 查看特定表的大小
select relname, pg_size_pretty(pg_relation_size(relid))
from pg_stat_user_tables
where schemaname='public' and relname='【表名】'
order by pg_relation_size(relid) desc;
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
已为社区贡献4条内容
所有评论(0)