Re: Variable length varlena headers redux - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Variable length varlena headers redux
Date
Msg-id 45D1D980.4050109@enterprisedb.com
Whole thread Raw
In response to Re: Variable length varlena headers redux  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Variable length varlena headers redux  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
Bruce Momjian wrote:
> Heikki Linnakangas wrote:
>> We would still require all datums with a 4-byte header to be 4-byte 
>> aligned, right? When reading, you would first check if it's a compressed 
>> or uncompressed header. If compressed, read the 1 byte header, if 
>> uncompressed, read the 4-byte header and do htonl or bitshifting. No 
>> need to do htonl or bitshifting on unaligned datums.
> 
> I am not sure how to handle the alignment issue.  If we require 1-byte
> headers to be 4-byte aligned, we lose a lot of the benefits of the
> 1-byte header.

Why would we require that?

I don't see a problem with having 4-byte header 4-byte aligned, and 
1-byte headers not aligned. The first access to the header is to check 
if it's a 4 or 1 byte header. That's a 1 byte wide access, requiring no 
alignment. After that you know which one it is.

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: XML changes broke assert-enabled vcbuild
Next
From: "Pavan Deolasee"
Date:
Subject: Re: HOT for PostgreSQL 8.3