Re: Question regarding the database page layout.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: "Ryan Bradetich" <rbradetich(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Question regarding the database page layout.
Date: 2008-09-02 18:35:31
Message-ID: 25437.1220380531@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gregory Stark <stark(at)enterprisedb(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2008-09-02 18:36:19 Re: Mysterious Bus Error with get_fn_expr_argtype()
Previous Message Tom Lane 2008-09-02 18:06:18 Re: Mysterious Bus Error with get_fn_expr_argtype()