Re: Unexpected table size usage for small composite arrays

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

I hear what you are saying Tom and what I have read says that it would take
24 + 12 x N bytes for the array. This isn't the case when I start adding
elements to the table. Here are some samples adding 10,000 rows with
difference elements in the composite array:

Row countArray elementsMain table sizeTOASTBytes / RowBytes / Entry
10000 0 933888 8192 93 0.0
10000 1 1417216 8192 142 49.0
10000 2 1826816 8192 183 45.0
10000 3 2220032 8192 222 43.0
10000 5 3039232 8192 304 42.2
10000 10 5120000 8192 512 41.9
10000 100 10240000 8192 1024 9.3
10000 200 20480000 8192 2048 9.8
10000 400 1015808 41467904 4248 10.4
10000 1000 1015808 87080960 8810 8.7

On Tue, Oct 22, 2024 at 6:50 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Erik Sjoblom <sjoblom65(at)gmail(dot)com> writes:
> > I don't see why it's using 50 bytes per element. There should be just one
> > 24 byte header for the array, not one per element
>
> [ shrug... ] I just told you that's not so.
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2024-10-22 23:41:22 Re: Unexpected table size usage for small composite arrays
Previous Message Tom Lane 2024-10-22 22:50:31 Re: Unexpected table size usage for small composite arrays