Re: Unexpected table size usage for small composite arrays

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Erik Sjoblom <sjoblom65(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Unexpected table size usage for small composite arrays
Date: 2024-10-22 22:34:52
Message-ID: 2093063.1729636492@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Erik Sjoblom <sjoblom65(at)gmail(dot)com> writes:
> I’m observing a storage behavior with arrays in a table that differs from
> my expectations, and I’d appreciate your insights. I was to store key value
> pairs in a very dense data model. I don't haver the requirement of search
> so that's why I was thinking an array of a composite type would work well.
> I can see that padding might be involved using the int4 and int8
> combination but there is more overhead. Anyone know where the following it
> coming from?

Composite values use the same 24-byte tuple headers as table rows do.
So you'd be looking at 40 bytes per array element in this example.
A large array of them would probably compress pretty well, but
it's never going to be cheap.

Can you store the int4's and int8's in two parallel arrays?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Erik Sjoblom 2024-10-22 22:45:41 Re: Unexpected table size usage for small composite arrays
Previous Message Jeff Davis 2024-10-22 22:27:31 Re: Statistics Import and Export