Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hJOU6-0000GZ-Ar for pgsql-general@arkaria.postgresql.org; Wed, 24 Apr 2019 20:27:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hJOU4-00051H-GJ for pgsql-general@arkaria.postgresql.org; Wed, 24 Apr 2019 20:27:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hJOU4-0004vw-1J for pgsql-general@lists.postgresql.org; Wed, 24 Apr 2019 20:27:12 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hJOU1-0005hE-GB for pgsql-general@lists.postgresql.org; Wed, 24 Apr 2019 20:27:10 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x3OKR67B014349; Wed, 24 Apr 2019 16:27:06 -0400 From: Tom Lane To: pabloa98 cc: "pgsql-generallists.postgresql.org" Subject: Re: how to add more than 1600 columns in a table? In-reply-to: References: Comments: In-reply-to pabloa98 message dated "Wed, 24 Apr 2019 13:17:17 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14347.1556137626.1@sss.pgh.pa.us> Date: Wed, 24 Apr 2019 16:27:06 -0400 Message-ID: <14348.1556137626@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk pabloa98 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