Re: Dept of ugly hacks: eliminating padding space in system indexes - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Dept of ugly hacks: eliminating padding space in system indexes
Date
Msg-id 4890.1214264752@sss.pgh.pa.us
Whole thread Raw
In response to Re: Dept of ugly hacks: eliminating padding space in system indexes  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-hackers
Simon Riggs <simon@2ndquadrant.com> writes:
> On Mon, 2008-06-23 at 15:52 -0400, Tom Lane wrote:
>> Cutting a third off the size of a system index has got to be worth
>> something, but is it worth a hack as ugly as this one?

> Not doing it would be more ugly, unless there is some negative
> side-effect?

I thought some more about why this seems ugly to me, and realized that a
lot of it has to do with the change in typalign.  Currently, a compiler
is entitled to assume that a pointer to Name is 4-byte aligned; thus
for instance it could generate word-wide instructions for copying a Name
from one place to another.  A "Name" that is stored as just CSTRING
might break that.  We are already at risk of this, really, because of
all the places where we gaily pass plain old C strings to syscache and
index searches on Name columns.  I think the only reason we've not been
burnt is that it's hard to optimize strcmp() into word-wide operations.

However the solution to that seems fairly obvious: let's downgrade Name
to typalign 1 instead of 4.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [PATCHES] Patch for Prevent pg_dump/pg_restore from being affected by statement_timeout
Next
From: Mark Mielke
Date:
Subject: Re: Dept of ugly hacks: eliminating padding space in system indexes