Re: Fixed length data types issue

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: Gregory Stark <gsstark(at)mit(dot)edu>, Bruce Momjian <bruce(at)momjian(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, Martijn van Oosterhout <kleptog(at)svana(dot)org>
Subject: Re: Fixed length data types issue
Date: 2006-09-11 13:29:15
Message-ID: 21766.1157981355@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>> I'm imagining that it would give you the same old uncompressed in-memory
>> representation as it does now, ie, 4-byte length word and uncompressed
>> data.

> Sure, but how would you know? Sometimes you would get a pointer to a varlena
> starting with a bytes with a leading 00 indicating a 1-byte varlena header and
> sometimes you would get a pointer to a varlena with the old uncompressed
> representation with a 4-byte length header which may well start with a 00.

Yeah, in that scheme you need some out-of-band information telling you
if the datum is compressed or not. The second scheme I posted avoids
that problem.

>> * If high order bit of first byte is 1, then it's some compressed
>> variant. I'd propose divvying up the code space like this:
>>
>> * 0xxxxxxx uncompressed 4-byte length word as stated above
>> * 10xxxxxx 1-byte length word, up to 62 bytes of data
>> * 110xxxxx 2-byte length word, uncompressed inline data
>> * 1110xxxx 2-byte length word, compressed inline data
>> * 1111xxxx 1-byte length word, out-of-line TOAST pointer

> I'm unclear how you're using the remaining bits.

Length (or high order bits of it, if the length covers more than 1 byte).

> Also Heikki points out here that it would be nice to allow for the case for a
> 0-byte header.

I don't think there's enough code space for that; at least not compared
to its use case.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2006-09-11 13:35:04 Re: Cassowary failing to report the results back to the
Previous Message Gregory Stark 2006-09-11 13:21:46 Re: Fixed length data types issue