Re: Variable length varlena headers redux

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Gregory Stark <gsstark(at)mit(dot)edu>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Variable length varlena headers redux
Date: 2007-02-13 15:43:30
Message-ID: 200702131543.l1DFhUJ24710@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas wrote:
> 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.

But if you are walking through attributes, how do you know to look at
the next byte or the next aligned byte? We have to force zeros in
there?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2007-02-13 15:44:47 Re: XML changes broke assert-enabled vcbuild
Previous Message Magnus Hagander 2007-02-13 15:40:45 Re: XML changes broke assert-enabled vcbuild