Re: byte-size of column values - Mailing list pgsql-general

From David G. Johnston
Subject Re: byte-size of column values
Date
Msg-id CAKFQuwZ7Uj5grF62CnAe7fUuSOJ5jtbNugj5DWcR3zoOmA27EA@mail.gmail.com
Whole thread Raw
In response to byte-size of column values  (Dominique Devienne <ddevienne@gmail.com>)
Responses Re: byte-size of column values
List pgsql-general
On Tue, Oct 18, 2022 at 8:53 AM Dominique Devienne <ddevienne@gmail.com> wrote:
Hi. I'm surprised by the result for bit(3) and char, when calling
pg_column_size().

Why 6, instead of 1? The doc does mention 5-8 bytes overhead, but I
expected those for varying bit, not fixed-sized bit typed values. How
come?


The base type is what matters, if the length of the actual type is a parameter (the (n) part) the underlying type must be variable, and thus has a component that says how long the actually stored value is.
 
How does one store as compactedly as possible several small enums, on
millions of rows?

int2
David J.

p.s., pretend char doesn't even exist.

pgsql-general by date:

Previous
From: Dominique Devienne
Date:
Subject: byte-size of column values
Next
From: Tom Lane
Date:
Subject: Re: byte-size of column values