免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5929 | 回复: 3
打印 上一主题 下一主题

postgres 库查看表的大小 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-03-15 16:23 |只看该作者 |倒序浏览
各位:
  小弟咨询下在postgres数据库中自建立一个库,该库中有N个表,从大到小的顺序排列表的大小,谢谢!

论坛徽章:
3
数据库技术版块每日发帖之星
日期:2015-06-18 22:20:00数据库技术版块每日发帖之星
日期:2015-06-21 22:20:00数据库技术版块每日发帖之星
日期:2015-08-27 06:20:00
2 [报告]
发表于 2012-03-18 21:59 |只看该作者
osdba=# select schemaname,tablename,pg_relation_size(schemaname||'.'||tablename) as tabsize from pg_tables order by 3 desc;
     schemaname     |        tablename        | tabsize  
--------------------+-------------------------+----------
public             | blograwlog              | 19243008
pg_catalog         | pg_proc                 |   499712
pg_catalog         | pg_depend               |   409600
pg_catalog         | pg_attribute            |   352256
pg_catalog         | pg_statistic            |   221184
pg_catalog         | pg_description          |   172032
pg_catalog         | pg_class                |   122880
pg_catalog         | pg_operator             |   106496
public             | blogstats               |    81920
public             | cnip                    |    73728
pg_catalog         | pg_rewrite              |    73728
pg_catalog         | pg_type                 |    65536
information_schema | sql_features            |    57344
pg_catalog         | pg_index                |    49152
public             | gp_conf_icbu            |    40960
public             | gp_conf_ccbu            |    40960
pg_catalog         | pg_amop                 |    24576
pg_catalog         | pg_conversion           |    24576
public             | gp_conf                 |    24576
pg_catalog         | pg_ts_config_map        |    16384
pg_catalog         | pg_opclass              |    16384
public             | gp_conf_ccbu_20110930   |    16384
pg_catalog         | pg_amproc               |    16384
pg_catalog         | pg_cast                 |    16384
pg_catalog         | pg_ts_template          |     8192
pg_catalog         | pg_foreign_data_wrapper |     8192
pg_catalog         | pg_namespace            |     8192
information_schema | sql_implementation_info |     8192
information_schema | sql_languages           |     8192
pg_catalog         | pg_authid               |     8192
information_schema | sql_packages            |     8192
information_schema | sql_parts               |     8192
pg_catalog         | pg_database             |     8192
information_schema | sql_sizing              |     8192
pg_catalog         | pg_enum                 |     8192
pg_catalog         | pg_attrdef              |     8192
pg_catalog         | pg_constraint           |     8192
pg_catalog         | pg_inherits             |     8192
pg_catalog         | pg_opfamily             |     8192
pg_catalog         | pg_am                   |     8192
pg_catalog         | pg_language             |     8192
pg_catalog         | pg_aggregate            |     8192
pg_catalog         | pg_trigger              |     8192
pg_catalog         | pg_tablespace           |     8192
pg_catalog         | pg_pltemplate           |     8192

论坛徽章:
0
3 [报告]
发表于 2012-03-19 22:36 |只看该作者
select schemaname,tablename,pg_relation_size(schemaname||'.'||tablename) as tabsize from pg_tables where schemaname='public' order by 3 desc;

论坛徽章:
0
4 [报告]
发表于 2012-03-21 13:22 |只看该作者
好的,谢谢!select relname,pg_relation_size(relname::regclass)/1000000 as table_size from pg_stat_user_tables order by table_size desc 这样语句可以查询出来表的大小!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP