048.PGSQL-系统表pg_stat_all_tables、pg_class、pg_tables、pg_indexes、pg_attribute

2021/8/4 2:06:02

本文主要是介绍048.PGSQL-系统表pg_stat_all_tables、pg_class、pg_tables、pg_indexes、pg_attribute,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

pg_stat_all_tables、pg_class、pg_tables、pg_indexes、pg_attribute

 

查看表大小

select pt.schemaname||'.'||pt.tablename,pg_relation_filepath(pt.schemaname||'.'||pt.tablename),
       pg_table_size(pt.schemaname||'.'||pt.tablename),
       pg_relation_size(pt.schemaname||'.'||pt.tablename),
       pg_total_relation_size(pt.schemaname||'.'||pt.tablename),
       pi.schemaname||'.'||pi.indexname,pg_relation_filepath(pi.schemaname||'.'||pi.indexname),
       pg_relation_size(pi.schemaname||'.'||pi.indexname),--指定的单个索引
       pg_indexes_size(pi.schemaname||'.'||pi.tablename) --表上的所有索引
 from pg_tables pt
      left outer join pg_indexes pi 
                   on pt.schemaname||'.'||pt.tablename = pi.schemaname||'.'||pi.tablename
where 1=1
  and pt.schemaname='myschema'
  and pt.tablename='o_ls_test'
 

 



这篇关于048.PGSQL-系统表pg_stat_all_tables、pg_class、pg_tables、pg_indexes、pg_attribute的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程