public inbox for [email protected]  
help / color / mirror / Atom feed
From: David G. Johnston <[email protected]>
To: Erik Sjoblom <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: [email protected]
Subject: Re: Unexpected table size usage for small composite arrays
Date: Tue, 22 Oct 2024 16:41:22 -0700
Message-ID: <CAKFQuwa32sJfr+OUrFX8VpfkoNXdRidK93RmLExz_4s-demBrA@mail.gmail.com> (raw)
In-Reply-To: <CAAW=00UjRF8oE-A3BgzNYD_Tj+VLe0v0Hr1oyxhcbg8aXq1=Pg@mail.gmail.com>
References: <CAAW=00XvzL9q6m2jgsd2YJJqzjjmBYyM3A1uaXuMMr19SpJ57A@mail.gmail.com>
	<[email protected]>
	<CAAW=00UjRF8oE-A3BgzNYD_Tj+VLe0v0Hr1oyxhcbg8aXq1=Pg@mail.gmail.com>

On Tue, Oct 22, 2024 at 3:46 PM Erik Sjoblom <[email protected]> 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.


view thread (3+ messages)

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: Unexpected table size usage for small composite arrays
  In-Reply-To: <CAKFQuwa32sJfr+OUrFX8VpfkoNXdRidK93RmLExz_4s-demBrA@mail.gmail.com>

* 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