Re: Size on disk of INT and BIGINT - not sure I'm getting it?

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: Pól Ua Laoínecháin <linehanp(at)tcd(dot)ie>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Size on disk of INT and BIGINT - not sure I'm getting it?
Date: 2021-05-28 09:51:07
Message-ID: CA+bJJbwinTdGBs1yWOdb8G6=Cp07Ek4RZN8_KJcuHxRMZ8vaCw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Pól:

On Fri, May 28, 2021 at 11:36 AM Pól Ua Laoínecháin <linehanp(at)tcd(dot)ie> wrote:
> BIGINTEGER and INTEGER tables the same size? Comparing tables of 100M records.
...
> test=# CREATE TABLE big_int (x BIGINT NOT NULL);
> test=# CREATE TABLE int_32 (y INT);
Bear in mind a row has more data than just the fields ( thingx like
xmin,xmax and some others ) and there are alignment issues, and other
things.

If, for example, the whole row needs to be 8-byte aligned on a
synthetic example with a single field the rows may be the same lengths
for both cases, note how your tables ocupy
3458Mb but the data is just 800/400 Mb.

You may want to investgate putting some more realistic data ( i.e.,
try 2/4/8 fields per row ) to gain some insight, and reading
https://www.postgresql.org/docs/current/storage-page-layout.html which
gives some pointers on where to go next.

Francisco Olarte.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Laura Smith 2021-05-28 10:20:30 Modelling versioning in Postgres
Previous Message Pól Ua Laoínecháin 2021-05-28 09:35:44 Size on disk of INT and BIGINT - not sure I'm getting it?