PostgreSQL查看数据库对象大小
1、查看某个数据库大小
select pg_size_pretty(pg_database_size('tzqdb'));
2、查看多个数据库大小
select pg_database.datname
,pg_size_pretty (pg_database_size(pg_database.datname)) AS size
from pg_database
order by pg_database_size(pg_database.datname) desc;
3、按顺序查看索引大小
select indexrelname
,pg_size_pretty(pg_relation_size(relid))
from pg_stat_user_indexes
where 1=1
-- and 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 1=1
-- and schemaname='public'
order by pg_relation_size(relid) desc;
文章来源地址https://www.toymoban.com/news/detail-609009.html
文章来源:https://www.toymoban.com/news/detail-609009.html
到了这里,关于PostgreSQL查看数据库对象大小的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!