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

postgresql 查看数据库、表的大小

root5年前 (2021-06-21)数据库1507
查看数据库的大小
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不可用,删除ib_logfile0和ib_logfile1恢复

mysql安装在虚拟机中,公司突然断电导致mysql启动失败查看mysql的error日志2021-05-19T06:44:51.993300Z 0 [ERROR] InnoDB: Ignoring the redo log due to...

dataX:超强的数据库数据互导工具

安装下载安装包http://datax-opensource.oss-cn-hangzhou.aliyuncs.com/datax.tar.gz 然后解压进入解压后文件的./bin自检命令python  datax.py ../j...

postgresql 导入导出sql 文件

pg_dump  -h localhost -U postgres -t tablename databasename >./test.sql导出 -t 表名  psql -d test1 -U...

postgresql 的安装使用

安装centos系统 9.6版本# Install the repository RPMsudo yum install -y https://download.postgresql.org/pub/repos/yum/repor...

centos7 安装mysql

centos7 安装mysql

下载rpm包wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm 安裝包仓库yum -y install * 或者yum -...

postgresql修改数据存储位置

postgresql修改数据存储位置

最近公司提供了一台新的服务器,同时有一个盘是ssd。同时为了测试postgresql的性能,将数据放置到ssd上系统centos7.9 数据库postgresql-9.6首先停掉数据库systemctl stop pos...