Re: PostgreSQL Limits and lack of documentation about them. - Mailing list pgsql-hackers

From John Naylor
Subject Re: PostgreSQL Limits and lack of documentation about them.
Date
Msg-id CAJVSVGVOme8JgZ17mFrhZuJX=mfgr4AxzpeatoP87uappAmMLA@mail.gmail.com
Whole thread Raw
In response to Re: PostgreSQL Limits and lack of documentation about them.  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-hackers
On 11/1/18, Andrew Gierth <andrew@tao11.riddles.org.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


pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: ON COMMIT actions and inheritance
Next
From: John Naylor
Date:
Subject: Re: PostgreSQL Limits and lack of documentation about them.