select schemaname,tablename,round(sum(pg_total_relation_size(schemaname || '.' || partitiontablename)::numeric)/1024/1024,2) "MB"
from pg_partitions
where tablename='a_mro_maxcoverage_lte_cell_d'
group by 1,2;
使用该sql统计表的大小:
'edw_app','a_mro_maxcoverage_lte_cell_d','5322.85'
insert into edw_dev.tmp_cd_11 或者 create table edw_dev.tmp_cd_11 as
select schemaname,tablename,round(sum(pg_total_relation_size(schemaname || '.' || partitiontablename)::numeric)/1024/1024,2) "MB"
from pg_partitions
where tablename='a_mro_maxcoverage_lte_cell_d'
group by 1,2;
同样执行把结果插入结构表数据就变了:
'edw_app','a_mro_maxcoverage_lte_cell_d','20.63'
为什么会有这样的结果呢?