pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pabloa98 <pabloa98@gmail.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: how to add more than 1600 columns in a table?
Date: Wed, 24 Apr 2019 16:27:06 -0400
Message-ID: <14348.1556137626@sss.pgh.pa.us> (raw)
In-Reply-To: <CAEjudX7ZtdVFAENPQUWVMe741N0me0Op24GHE4ibPdm--hJHvw@mail.gmail.com>
References: <CAEjudX7ZtdVFAENPQUWVMe741N0me0Op24GHE4ibPdm--hJHvw@mail.gmail.com>

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





view thread (20+ messages)  latest in thread

Message-ID: <14348.1556137626@sss.pgh.pa.us>
Permalink:  ../14348.1556137626@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/14348.1556137626@sss.pgh.pa.us

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pabloa98@gmail.com
  Subject: Re: how to add more than 1600 columns in a table?
  In-Reply-To: <14348.1556137626@sss.pgh.pa.us>
  References: <CAEjudX7ZtdVFAENPQUWVMe741N0me0Op24GHE4ibPdm--hJHvw@mail.gmail.com> <14348.1556137626@sss.pgh.pa.us>

* 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