Re: Dept of ugly hacks: eliminating padding space in system indexes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Dept of ugly hacks: eliminating padding space in system indexes
Date: 2008-06-23 23:45:52
Message-ID: 4890.1214264752@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Simon Riggs <simon(at)2ndquadrant(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Mielke 2008-06-24 00:19:59 Re: Dept of ugly hacks: eliminating padding space in system indexes
Previous Message Bruce Momjian 2008-06-23 23:30:53 Re: [HACKERS] Patch for Prevent pg_dump/pg_restore from being affected by statement_timeout