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 1hJR4v-0007c8-66 for pgsql-general@arkaria.postgresql.org; Wed, 24 Apr 2019 23:13:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hJR4t-0004XJ-5E for pgsql-general@arkaria.postgresql.org; Wed, 24 Apr 2019 23:13:23 +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 1hJR4s-0004Q3-Ld for pgsql-general@lists.postgresql.org; Wed, 24 Apr 2019 23:13:22 +0000 Received: from mbx.knossos.net.nz ([202.160.48.10]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hJR4p-0000xW-Dp for pgsql-general@lists.postgresql.org; Wed, 24 Apr 2019 23:13:21 +0000 Received: from [192.168.77.204] (default-rdns.vocus.co.nz [121.99.202.67] (may be forged)) (authenticated bits=0) by mbx.knossos.net.nz (8.14.4/8.14.4) with ESMTP id x3ONDAtx015990 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Thu, 25 Apr 2019 11:13:10 +1200 Subject: Re: how to add more than 1600 columns in a table? To: Alvaro Herrera , pabloa98 Cc: Joe Conway , "pgsql-generallists.postgresql.org" References: <20190424225519.GA8439@alvherre.pgsql> From: Gavin Flower Organization: ArchiDevSys Message-ID: <97894961-e759-a110-86d7-e5950c7d4ea7@archidevsys.co.nz> Date: Thu, 25 Apr 2019 11:13:10 +1200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190424225519.GA8439@alvherre.pgsql> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 25/04/2019 10:55, Alvaro Herrera wrote: > On 2019-Apr-24, pabloa98 wrote: > >> Regarding to (2), We are good by adding a patch and recompile a patched >> version for our server databases. >> >> But we are open on helping to add thousands of columns support as a >> compile-time parameter if there are other people interested. > It's hard to say what you're doing wrong when we don't know > what are you actually doing. > > I think raising the limit requires changing ItemIdData, t_hoff, and a > few members of PageHeaderData at the very least. Reading the three > header files involved carefully would probably point out areas I've > forgotten to mention. I think if you enlarge t_hoff and lp_off/lp_len > to 16 bits, you can use 64kB blocks, which might be useful too. > > Note that with pg12 you could have your own table AM that supported > wider ItemIds as a (small?) change on heapam, rather than supplant it > for all tables. That way you would only pay the (probably considerable) > cost of the wider line pointers on all tables ... > I wonder if it might prove a killer feature for some niche uses! Stranger things have come to pass. Suspect that going beyond 1600 columns would never be the default, even if the pg core devs, were happy to allow it as an official option (presumably at compile time?).  As I think it would have negative performance impacts on the most uses of pg - as Alvaro hinted at.  IMnsHO Certainly the will be many people intrigued as to what you are trying to do, even if we never want to do the same ourselves.