Re: Question regarding the database page layout. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Question regarding the database page layout.
Date
Msg-id 25437.1220380531@sss.pgh.pa.us
Whole thread Raw
In response to Re: Question regarding the database page layout.  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: Question regarding the database page layout.  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> The other 4 bytes you could save is by packing the whole tuples themselves
> more closely on the page. That happens when the item pointer is added and
> pointed to the tuple. To do that heap_form_tuple would have to return data
> back to the caller about the alignment needed to whomever is going to copy it
> into the page. AFAICS that could be done in the HeapTuple structure itself
> rather than in the tuple though which doesn't seem so bad. Tom may be seeing
> something I'm not though.

You'd need to keep the info available for subsequent re-compactions of
the page, so I think an infomask bit is really the only solution that
would work.

But on reflection, that's really a separable issue from whether we
minimize t_hoff padding.  And as Ryan's patch shows, it's not that hard
to do the latter.  We should probably grab the low-hanging fruit here.

> Incidentally, can't you set the alignment during the compute_data_size() call
> instead of doing an extra pass through the attributes?

+1.  This code is executed often enough that every little bit helps.

BTW, there are at least two copies of that code to be changed.  I'd
suggest grepping for assignments to t_hoff to be sure there aren't more.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Mysterious Bus Error with get_fn_expr_argtype()
Next
From: "David E. Wheeler"
Date:
Subject: Re: Mysterious Bus Error with get_fn_expr_argtype()