public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: David G. Johnston <[email protected]>
Cc: Ron Johnson <[email protected]>
Cc: pgsql-generallists.postgresql.org <[email protected]>
Subject: Re: Postgres do not support tinyint?
Date: Wed, 08 Jan 2025 01:53:34 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAKFQuwYYgPxUSvo2UzOty5Cd1xw5+2q1bg3+zY-nsXNZyq+_4g@mail.gmail.com>
References: <CA+FnnTzfvgVdptHcLBFPrq_Q+xPes-Bhjiw_xFiooq4VqhqyrQ@mail.gmail.com>
	<CANzqJaCxZK0j8fL-riZpX+AV+kyo9PcAvgF=H5DgaWK+C+66Vw@mail.gmail.com>
	<CAKFQuwYYgPxUSvo2UzOty5Cd1xw5+2q1bg3+zY-nsXNZyq+_4g@mail.gmail.com>

"David G. Johnston" <[email protected]> writes:
> On Tuesday, January 7, 2025, Ron Johnson <[email protected]> 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






view thread (7+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Postgres do not support tinyint?
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox