From: Scott Ribe <scott_ribe@elevated-dev.com>
To: nunks <nunks.lol@gmail.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Subject: Re: [pgsql-admin] "Soft-hitting" the 1600 column limit
Date: Wed, 6 Jun 2018 10:56:49 -0600
Message-ID: <15A38616-5CE2-42C4-A2F0-9FA16360761D@elevated-dev.com> (raw)
In-Reply-To: <CAKFQuwbuurPFxQ=ts2znAC-STpF9AW7C91qKXsGThWQr8u4Faw@mail.gmail.com>
References: <CACq6szQbQDG6_mThyH32=6J0e99-KdqOrhZMm9QwvGoVFzNbBw@mail.gmail.com>
<CAKFQuwbuurPFxQ=ts2znAC-STpF9AW7C91qKXsGThWQr8u4Faw@mail.gmail.com>
David's answer is right. Basically every column added gets an index # which is not recycled.
I just want to add that a dump/restore will not bring in the history of deleted columns, thus resetting the column counter for the table.
--
Scott Ribe
scott_ribe@elevated-dev.com
https://www.linkedin.com/in/scottribe/> On Jun 6, 2018, at 10:51 AM, David G. Johnston <david.g.johnston@gmail.com> wrote:
>
> On Wed, Jun 6, 2018 at 9:39 AM, nunks <nunks.lol@gmail.com> wrote:
> I reproduced this behavior in PostgreSQL 10.3 with a simple bash loop and a two-column table, one of which is fixed and the other is repeatedly dropped and re-created until the 1600 limit is reached.
>
> To me this is pretty cool, since I can use this limit as leverage to push the developers to the right path, but should Postgres be doing that? It's as if it doesn't decrement some counter when a column is dropped.
>
> This is working as expected. When dropping a column, or adding a new column that can contain nulls, PostgreSQL does not, and does not want to, rewrite the physically stored records/table. Thus it must be capable of accepting records formed for prior table versions which means it must keep track of those now-deleted columns.
>
> I'm sure that there is more to it that requires reading, and understanding, the source code to comprehend; but that does seem to explain why its works the way it does.
>
> David J.
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: scott_ribe@elevated-dev.com, nunks.lol@gmail.com, david.g.johnston@gmail.com
Subject: Re: [pgsql-admin] "Soft-hitting" the 1600 column limit
In-Reply-To: <15A38616-5CE2-42C4-A2F0-9FA16360761D@elevated-dev.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox