查看GP空间

select table_schema,table_name,sz,
cast (
cast(substring(sz,1,length(sz)-3) as decimal(18,2))*
(
case when sz like '%k%' then power(10,-13)
when sz like '%M%' then power(10,0)
when sz like '%G%' then power(10,3)
end
) as decimal(18,2)) as sz_MB
from 
(
select 
table_schema,table_name,pg_size_pretty(pg_total_relation_size(table_schema||'.'||table_name)) as sz 
from information_schema.tables
where table_schema='ads'
) as a 
order by sz_MB desc 
 

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页