Plan for compressed varlena headers - Mailing list pgsql-hackers

From Gregory Stark
Subject Plan for compressed varlena headers
Date
Msg-id 87tzxou8zl.fsf@stark.xeocode.com
Whole thread Raw
Responses Re: Plan for compressed varlena headers  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Plan for compressed varlena headers  (Bruce Momjian <bruce@momjian.us>)
List 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
andwould 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.
Thiseither 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
usingbytewise lookups -- ie  by casting to (char*). That means network byte order or using the low order  bits is
equallyefficient.
 

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
recognizethe new headers.
 
  Actually mostly these should just work because att_addlength uses VARSIZE  but there may be additional changes. Other
placesthat use att_addlength  and need to be checked are heaptuple.c, indextuple.c, arrayfuncs.c,  datum.c, varlena.c,
andexecQual.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


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Writing triggers in C++
Next
From: Tom Lane
Date:
Subject: Re: HOT for PostgreSQL 8.3