Re: Column storage positions

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
Cc: "Stephan Szabo" <sszabo(at)megazone(dot)bigpanda(dot)com>, "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "Phil Currier" <pcurrier(at)gmail(dot)com>, "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Column storage positions
Date: 2007-02-21 22:38:02
Message-ID: 87zm77nnlh.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Andrew Dunstan" <andrew(at)dunslane(dot)net> writes:

> I would want to see this very carefully instrumented. Assuming we are putting
> all fixed size objects at the front, which seems like the best arrangement,
> then the position of every fixed field and the fixed portion of the position of
> every varlena field can be precalculated (and in the case of the leftmost
> varlena field that's it's complete position).

I'm not sure what you mean by "the fixed portion of the position of every
varlena field". Fields are just stuck one after the other (plus alignment)
skipping nulls. So any field after a null or varlena field can't have its
position cached at all.

Sadly one effect of the 1-byte header varlenas is that the position of the
first varlena can't be cached any more. That's because its alignment depends
on whether you're storing a short varlena or a full 4-byte varlena.

Currently there's an exception for the first column of the table since that's
always at offset 0. We could add another exception and cache the first varlena
if it happens to land on an intaligned offset without any extra alignment. I'm
not sure if that pays for itself or not though. It still only helps 25% of the
time and only for the first varlena so it doesn't seem terribly important.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthew T. O'Connor 2007-02-21 22:40:53 Re: autovacuum next steps, take 2
Previous Message Andrew Dunstan 2007-02-21 22:37:05 Re: Column storage positions