Re: Unexpected table size usage for small composite arrays

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Erik Sjoblom <sjoblom65(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Unexpected table size usage for small composite arrays
Date: 2024-10-22 23:41:22
Message-ID: CAKFQuwa32sJfr+OUrFX8VpfkoNXdRidK93RmLExz_4s-demBrA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Oct 22, 2024 at 3:46 PM Erik Sjoblom <sjoblom65(at)gmail(dot)com> wrote:

>
> Yes, I did expect that the first element should take 24+12 bytes and let's
> round that to 50 bytes.
>

Assuming the 24 is coming from the array overhead you are expecting that
storing a custom composite typed value takes zero overhead. That is a
faulty assumption. A user created custom type always takes some overhead
because it is considered a variable structure, even in the case where all
of its fields are fixed-width. Furthermore, it is self-describing, and so
that description has to go somewhere. Therefore, there must be a non-zero
per-element overhead to store composite values within an array. As Tom
told you, the specific non-zero number is 24 bytes.

David J.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2024-10-22 23:42:56 Re: Unexpected table size usage for small composite arrays
Previous Message Erik Sjoblom 2024-10-22 23:40:14 Re: Unexpected table size usage for small composite arrays