Re: byte-size of column values

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Dominique Devienne <ddevienne(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: byte-size of column values
Date: 2022-10-18 16:04:11
Message-ID: CAKFQuwZ7Uj5grF62CnAe7fUuSOJ5jtbNugj5DWcR3zoOmA27EA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Oct 18, 2022 at 8:53 AM Dominique Devienne <ddevienne(at)gmail(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-10-18 16:04:48 Re: byte-size of column values
Previous Message Dominique Devienne 2022-10-18 15:51:26 byte-size of column values