
The day I reached the 1600 columns limit in PostgreSQL - craigkerstiens
https://rosenfeld.herokuapp.com/en/articles/programming/2017-09-26-the-day-i-reached-the-1600-columns-limit-in-postgresql
======
moxious
Why Is there a limit on the number of columns I can have, and if something bad
happens from having too many, why isn't the limit much lower than 1600, which
hopefully most of us can agree is already way beyond absurd?

~~~
petereisentraut
It has to do with how the tuple header that stores the metadata is designed.
See comments here:
[https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f...](https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/include/access/htup_details.h;h=dcfcffc5cb858ed6493e37bc2ac76338b896c7ae;hb=254bb39b720426f7a4616cb6b40f810c44b24b20)

------
fictionfuture
Maybe Im missing the point, but After reading that I still don't understand
why you couldn't just add a permanent column and continually overwrite it.

~~~
vorotato
You don't understand it because he doesn't understand the problem well enough
to explain it, which is why he ever had this problem in the first place.

~~~
shredprez
Any chance we can get a quick post mortem?

~~~
rosenfeld
As pstuart mentioned, one of the post mortem was to fix the script, which I
did by using a temporary table.

The other part was to enable new columns to be added to that table in case we
need in the future. For that part, I locked a few tables for writing,
recreated them with a separate name and replaced the old with the new one in
order to avoid any downtime or dealing with master-slave set-ups to be able to
dump and restore without downtimes. Full vacuum freeze wouldn't reclaim that
space back.

------
mlevental
I had this problem for real and there was no solution: parsing Edgar sec
quarterly reports and trying to stick every field into its column. there was
no solution so we just through out some of the fields.

