Reputation: 1276
According to the limits postgres supports up to 1600 columns per table. https://www.postgresql.org/docs/current/limits.html
I understand that it's bad practice to have so many columns but what are the consequences of approaching this limit?
For example, will a table with 200 columns perform fine in an application? How can you tell when you're approaching too many columns for a given table?
Upvotes: 0
Views: 219
Reputation: 246523
The hard limit is that a table row has to fit inside a single 8kB block.
The "soft limits" you encounter with many columns are
writing SELECT
list becomes more and more annoying (never, ever, use SELECT *
)
each UPDATE
has to write a large row version, so lots of data churn
extracting the 603th column from a row requires skipping the previous 602 columns, which is a performance hit
it is plain annoying if the output of \d
is 50 pages long
Upvotes: 1