 --Alignmet Padding Analysis: how many bytes can be saved if columns are ordered better?
 
 -- TODO: not-yet-analyzed tables – show a warning (cannot get n_live_tup -> cannot get total bytes)
--- TODO: NULLs!!
+-- TODO: NULLs
+-- TODO: simplify, cleanup
+-- TODO: chunk_size 4 or 8
 with recursive constants as (
   select 8 as chunk_size
 ), columns as (

    when padding_total_est > 0 then '~' || pg_size_pretty(padding_total_est) || ' (' || wasted_percent::text || '%)'
    else ''
  end as "Wasted",
  case when padding_total_est > 0 then array_to_string(alt_cols, ', ') else null end as "Suggested Columns Reorder"
\if :postgres_dba_wide
  ,
  padding_sum as "Bytes Wasted in a Row",

    column_name,
    udt_name,
    typalign,
    typlen,
    _shift,
    alt_order_group,
    character_maximum_length
