"David G. Johnston" <david.g.johns...@gmail.com> writes:
> On Tuesday, January 7, 2025, Ron Johnson <ronljohnso...@gmail.com> wrote:
>> 3. The "bit" type might serve your needs.

> You suggest a type with a minimum size of 6 bytes when the complaint is
> that the otherwise acceptable 2 byte data type is too large?

I think the point here is that there's zero value in trying to pack a
small integer value into 1 byte (let alone 4 bits) if it's all by
its lonesome in the row.  Alignment padding will eat whatever gain
you thought you had.  If you want a win, you need to store a lot of
such values in one field.  Ron's suggesting that you pack them into
bit arrays and manually insert/extract individual values.  That could
be worth doing if you were sufficiently desperate, but you'd have to
value compact storage over access simplicity quite a lot.

Perhaps a "char"[] array (note the quotes) would provide an
intermediate level of compactness versus pain.

                        regards, tom lane


Reply via email to