firstname.lastname@example.org (YAMAMOTO Takashi) writes:
how about making heap_form_tuple and its variants use smaller natts for
tuples whose trailing columns are NULL?
This idea has been proposed before, and rejected on the basis that it's
unlikely to save enough to be worth the cycles needed to check for the
case. Keep in mind that you aren't going to save anything at all unless
the bitmap length decreases across a MAXALIGN boundary.
but it also means that, if one-bit descrease happens to cross the boundary,
you can save a MAXALIGN, right?
btw, while playing with this, i noticed that pg_column_size+rowtype+aggregate
produces unstable results. i guess it's because when nodeAgg handles
grp_firstTuple, the tuple is converted to a short varlena. i don't know
if it can be a real problem than just a weird looking.
test=# create table t (i int);
test=# insert into t values (1),(2),(3);
INSERT 0 3
test=# select pg_column_size(t.*) from t;
test=# select string_agg(pg_column_size(t.*)::text,',') from t;