本文共 441 字,大约阅读时间需要 1 分钟。
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转载地址:http://epfmi.baihongyu.com/