Re: how to add more than 1600 columns in a table? - Mailing list pgsql-general

From Tom Lane
Subject Re: how to add more than 1600 columns in a table?
Date
Msg-id 14348.1556137626@sss.pgh.pa.us
Whole thread Raw
In response to how to add more than 1600 columns in a table?  (pabloa98 <pabloa98@gmail.com>)
Responses Re: how to add more than 1600 columns in a table?
List pgsql-general
pabloa98 <pabloa98@gmail.com> writes:
> Sadly today we hit the 1600 columns limit of Postgresql 11.
> How could we add more columns?

You can't, at least not without some pretty fundamental changes;
that value is limited by field sizes within tuple headers.  You'd
also, more than likely, find yourself hitting problems with the
tuples-can't-cross-page-boundary restrictions.  (Our TOAST mechanism
avoids that problem for large individual fields, but not for many small
fields.)

It seems pretty unlikely to me that any sane table design actually
has thousands of truly-independent columns.  Consider using arrays,
or perhaps composite sub-structures (JSON maybe?).

            regards, tom lane



pgsql-general by date:

Previous
From: Ron
Date:
Subject: Re: how to add more than 1600 columns in a table?
Next
From: "David G. Johnston"
Date:
Subject: Re: how to add more than 1600 columns in a table?