Plan for compressed varlena headers

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Plan for compressed varlena headers
Date: 2007-02-14 14:09:02
Message-ID: 87tzxou8zl.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


So to implement the agreed upon plan I see the following items.

1) Replace the VARATT_SIZEP macro with SET_VARLENA_LEN. I intend to keep this
patch separate as it will bitrot quickly and would be best if it could be
applied as soon as possible even before the main patch is committed.

I just sent a patch to do this with some notes to pgsql-patches.

2) Replace VARATT* macros to store and retrieve the toast bits in a manner
that will work for variable length headers. This either means storing the
bits at the least-significant position or using network byte order.

If we want to allow storing >1 headers unaligned which I think would be
good then I still think we have to read them using bytewise lookups -- ie
by casting to (char*). That means network byte order or using the low order
bits is equally efficient.

3) Have VARSIZE and VARATT_SIZE recognize short headers and produce accurate
values.

4) Change heap_deform*tuple, heap_getattr and any other functions and macros
in heapam.c that step through tuples to recognize the new headers.

Actually mostly these should just work because att_addlength uses VARSIZE
but there may be additional changes. Other places that use att_addlength
and need to be checked are heaptuple.c, indextuple.c, arrayfuncs.c,
datum.c, varlena.c, and execQual.c, and flatfiles.c.

5) Change pg_detoast_datum to recognize the new header types and decompress
them.

5) Change heap_form_tuple to compress headers where possible.

6) Fix the toaster to generate new-style toasted data

Did I miss anything?

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-02-14 15:41:53 Re: HOT for PostgreSQL 8.3
Previous Message Alvaro Herrera 2007-02-14 13:20:27 Re: Writing triggers in C++