PG里如何查看表,索引,表空间,数据库大小
答案:2 悬赏:50 手机版
解决时间 2021-03-25 11:18
- 提问者网友:低吟詩仙的傷
- 2021-03-25 04:40
PG里如何查看表,索引,表空间,数据库大小
最佳答案
- 五星知识达人网友:怀裏藏嬌
- 2020-03-14 10:35
--查询一个索引大小
select pg_size_pretty(pg_relation_size('indexname))--查看一张表及此它上的索引总大小
select pg_size_pretty(pg_total_relation_size('tablename')); --查看所有 schema里面索引大小,大到小的顺序排列:
select indexrelname,pg_size_pretty( pg_relation_size(relid))
from pg_stat_user_indexes where schemaname = 'schemaname' order by pg_relation_size(relid) desc;--查看所有 schema里面表的大小,从大到小顺序排列:
select relname, pg_size_pretty(pg_relation_size(relid))
from pg_stat_user_tables where schemaname = 'schemaname' order by pg_relation_size(relid) desc; --查看数据库大小:
select pg_database.datname,pg_size_pretty(pg_database_size(pg_database.datname)) AS size
from pg_database;--查看表空间大小
select pg_size_pretty(pg_relation_size('indexname))--查看一张表及此它上的索引总大小
select pg_size_pretty(pg_total_relation_size('tablename')); --查看所有 schema里面索引大小,大到小的顺序排列:
select indexrelname,pg_size_pretty( pg_relation_size(relid))
from pg_stat_user_indexes where schemaname = 'schemaname' order by pg_relation_size(relid) desc;--查看所有 schema里面表的大小,从大到小顺序排列:
select relname, pg_size_pretty(pg_relation_size(relid))
from pg_stat_user_tables where schemaname = 'schemaname' order by pg_relation_size(relid) desc; --查看数据库大小:
select pg_database.datname,pg_size_pretty(pg_database_size(pg_database.datname)) AS size
from pg_database;--查看表空间大小
全部回答
- 1楼网友:深街酒徒
- 2019-05-22 05:28
支持一下感觉挺不错的
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯