diff --git a/sql/Bloat/table/table_bloat.sql b/sql/Bloat/table/table_bloat.sql index 0cdf7ba..45198cc 100644 --- a/sql/Bloat/table/table_bloat.sql +++ b/sql/Bloat/table/table_bloat.sql @@ -35,8 +35,7 @@ FROM ( current_setting('block_size')::numeric AS bs, CASE WHEN version()~'mingw32' OR version()~'64-bit|x86_64|ppc64|ia64|amd64' THEN 8 ELSE 4 END AS ma, 24 AS page_hdr, - 23 + CASE WHEN MAX(coalesce(null_frac,0)) > 0 THEN ( 7 + count(*) ) / 8 ELSE 0::int END - + CASE WHEN tbl.relhasoids THEN 4 ELSE 0 END AS tpl_hdr_size, + 23 + CASE WHEN MAX(coalesce(null_frac,0)) > 0 THEN ( 7 + count(*) ) / 8 ELSE 0::int END AS tpl_hdr_size, sum( (1-coalesce(s.null_frac, 0)) * coalesce(s.avg_width, 1024) ) AS tpl_data_size, bool_or(att.atttypid = 'pg_catalog.name'::regtype) OR count(att.attname) <> count(s.attname) AS is_na @@ -48,7 +47,7 @@ FROM ( LEFT JOIN pg_class AS toast ON tbl.reltoastrelid = toast.oid WHERE att.attnum > 0 AND NOT att.attisdropped AND tbl.relkind = 'r' - GROUP BY 1,2,3,4,5,6,7,8,9,10, tbl.relhasoids + GROUP BY 1,2,3,4,5,6,7,8,9,10 ORDER BY 2,3 ) AS s ) AS s2