设为首页 加入收藏

TOP

PostgreSQL查看数据库,索引,表,表空间大小(三)
2014-11-24 03:23:48 来源: 作者: 【 】 浏览:11
Tags:PostgreSQL 查看 数据库 索引 空间 大小
lect relname, pg_size_pretty(pg_relation_size(relid)) from pg_stat_user_tables where schemaname='public' order by pg_relation_size(relid) desc;
relname | pg_size_pretty
-------------------------------+----------------
test | 91 MB
testtable | 1424 kB
city | 256 kB
countrylanguage | 56 kB
country | 40 kB
testcount | 8192 bytes
tbl_partition_201302 | 8192 bytes
tbl_partition_201303 | 8192 bytes
person | 8192 bytes
customer | 8192 bytes
american_state | 8192 bytes
tbl_david | 8192 bytes
emp | 8192 bytes
tbl_partition_201212 | 8192 bytes
tbl_partition_201304 | 8192 bytes
tbl_partition_error_join_date | 8192 bytes
tbl_partition_201211 | 8192 bytes
album | 8192 bytes
tbl_partition_201307 | 8192 bytes
tbl_xulie | 8192 bytes
tbl_partition_201301 | 8192 bytes
sale | 8192 bytes
item | 8192 bytes
track | 8192 bytes
tbl_partition_201306 | 0 bytes
tbl_partition | 0 bytes
tbl_partition_201305 | 0 bytes
person2 | 0 bytes
(28 rows)
david=#
3.10 查看表空间大小
david=# select spcname from pg_tablespace;
spcname
------------
pg_default
pg_global
(2 rows)
david=# select pg_tablespace_size('pg_default');
pg_tablespace_size
--------------------
28381579760
(1 row)
david=# select pg_size_pretty(pg_tablespace_size('pg_default'));
pg_size_pretty
----------------
26 GB
(1 row)
david=#
另一种查看方法:
david=# select pg_tablespace_size('pg_default')/1024/1024 as "SIZE M";
SIZE M
--------
27066
(1 row)
david=# select pg_tablespace_size('pg_default')/1024/1024/1024 as "SIZE G";
SIZE G
--------
26
(1 row)
david=#
首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇overwrite在hive内部表及外部表特.. 下一篇oracle中查询一个表中字段名是否..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·用 C 语言或者限制使 (2025-12-25 08:50:05)
·C++构造shared_ptr为 (2025-12-25 08:50:01)
·既然引用计数在做 GC (2025-12-25 08:49:59)
·Java 编程和 c 语言 (2025-12-25 08:19:48)
·. net内存管理宝典这 (2025-12-25 08:19:46)