Re: Reducing data type space usage - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Reducing data type space usage
Date
Msg-id 27210.1158588314@sss.pgh.pa.us
Whole thread Raw
In response to Re: Reducing data type space usage  (Hannu Krosing <hannu@skype.net>)
List pgsql-hackers
Hannu Krosing <hannu@skype.net> writes:
> would adding this -

>     first byte 0xxxxxxx  ---- field length 1 byte, exactly that value
>     first byte 10xxxxxx  ---- 0xxxxxx data bytes follow
>     first byte 110xxxxx  -- xxxxx xxxxxxxx data bytes to follow
>     first byte 111xxxxx  -- xxxxx xxxxxxxx xxxxxxxx xxxxxxxx bytes t.flw

> be too expensive ?

What's the point?  Unless there's provision for TOAST, you can't put
arbitrarily long strings on disk anyway, so I don't see what this
datatype can do that is much better than the simpler version.  If you
try to fit TOAST in, then you are back to exactly the var-length-varlena
proposals upthread.

To me the only really compelling argument for worrying about the size
of the header is for fields that are certain to be short, such as
poor-mans-enumerated-type strings, part numbers, etc.  The
zero-or-one-byte header approach seems to handle that use-case just
fine.  I think more complicated approaches are going to add lots of
code and cycles for only very marginal gains.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Gevik Babakhani
Date:
Subject: OID conflicts
Next
From: Tom Lane
Date:
Subject: Re: 8.2 beta blockers