Martijn van Oosterhout wrote:
-- Start of PGP signed section.
> On Fri, Sep 08, 2006 at 09:28:21AM -0400, [EMAIL PROTECTED] wrote:
> > > But that won't help in the example you posted upthread, because char(N) 
> > > is not fixed-length.
> > 
> > It can be fixed-length, or at least, have an upper bound. If marked
> > up to contain only ascii characters, it doesn't, at least in theory,
> > and even if it is unicode, it's not going to need more than 4 bytes
> > per character. char(2) through char(16) only require 4 bits to
> > store the length header, leaving 4 bits for encoding information.
> > bytea(2) through bytea(16), at least in theory, should require none.
> If your talking about an upper-bound, then it's not fixed length
> anymore, and you need to expend bytes storing the length. ASCII bytes
> only take one byte in most encodings, include UTF8.
> Doodling this morning I remember why the simple approach didn't work.
> If you look at the varlena header, 2 bits are reserved. Say you take
> one bit to indicate "short header". Then lengths 0-31 bytes can be
> represented with a one byte header, yay!
> However, now you only have enough bits leftover to store 29 bits for
> the length, so we've just cut the maximum datum size from 1GB to 512MB.
> Is that a fair trade? Probably not, so you'd need a more sophisticated
> scheme.

I was hoping we could have both bits true mean short header, but that is
also used by our system to indicate compressed and TOAST usage.  For
testing, I would just grab a bit and see how thing go.

  Bruce Momjian   [EMAIL PROTECTED]

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

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to