当前位置:首页 > 数据库 > 正文内容

postgresql 查看数据库、表的大小

root5年前 (2021-06-21)数据库1458
查看数据库的大小
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


扫描二维码推送至手机访问。

版权声明:本文由一叶知秋发布,如需转载请注明出处。

本文链接:https://zhiqiu.top/?id=129

分享给朋友:

相关文章

mysql启动失败 日志InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 3485

mysql报错Ignoring the redo log due to missing MLOG_CHECKPOINT betweenmysql版本:5.7.33系统版本:ubuntu16.04由于电脑突然关闭,跑在VMware里面的mys...

mysql 导出csv格式数据

mysql -e "select * from newsdb.t_hk_stock_news where id <100  ...

centos7 快速搭建 mysql

https://blog.csdn.net/qq_36582604/article/details/80526287...

mysql数据导入es

将mysql数据取出放到elasticsearch中from datetime import datetime from elasticsearch import Elastic...

clickhouse 搭建

通过docker 部署clickhousedocker-compose文件内容如下:services:     ipwave-clickhouse:     ...