Blogmark
What happens when you add and remove a column from a table in Postgres
via jbranchaud@gmail.com
https://www.linkedin.com/posts/gwenshapira_what-happens-when-you-add-and-remove-a-column-activity-7320517353597718529-u_Fi
PostgreSQL
Here’s the question that Gwen poses:
What happens when you add and remove a column from a table in Postgres 2000 times?
I couldn’t come up with any good guesses.
The surprising answer is that PostgreSQL 1) has a hard limit of 1600 columns on any given table and 2) that removes columns are effectively soft-deleted. This means that each column you add to a table, regardless of whether it is later deleted, will contribute to that hard limit.
If you somehow run into this limit in a real-world database deployment (unlikely), you’ll have to swap everything into a new table to get around it.