Re: PostgreSQL Limits and lack of documentation about them.

From: John Naylor <jcnaylor(at)gmail(dot)com>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: "Nasby, Jim" <nasbyj(at)amazon(dot)com>, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: PostgreSQL Limits and lack of documentation about them.
Date: 2018-11-06 10:47:37
Message-ID: CAJVSVGVOme8JgZ17mFrhZuJX=mfgr4AxzpeatoP87uappAmMLA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/1/18, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> wrote:
> So (with 8k blocks) the limit on the number of non-null external-toasted
> columns is about 450, while you can have the full 1600 columns if they
> are integers or smaller, or just over 1015 bigints. But you can have
> 1600 text columns if they average 4 bytes or less (excluding length
> byte).
>
> If you push too close to the limit, it may even be possible to overflow
> the tuple size by setting fields to null, since the null bitmap is only
> present if at least one field is null. So you can have 1010 non-null
> bigints, but if you try and do 1009 non-null bigints and one null, it
> won't fit (and nor will 999 non-nulls and 11 nulls, if I calculated
> right).

Thanks for that, Andrew, that was insightful. I drilled down to get
the exact values:

Non-nullable columns:
text (4 bytes each or less): 1600
toasted text: 452
int: 1600
bigint: 1017

Nullable columns with one null value:
text (4 bytes each or less): 1600
toasted text: 449
int: 1600
bigint: 1002

-John Naylor

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2018-11-06 10:50:33 Re: BUG #15449: file_fdw using program cause exit code error when using LIMIT
Previous Message Amit Langote 2018-11-06 10:04:17 Re: ON COMMIT actions and inheritance