Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fvMzX-0006KQ-CM for pgsql-general@arkaria.postgresql.org; Thu, 30 Aug 2018 13:28:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fvMzU-0003HO-NR for pgsql-general@arkaria.postgresql.org; Thu, 30 Aug 2018 13:28:04 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fvMzU-0003HG-93 for pgsql-general@lists.postgresql.org; Thu, 30 Aug 2018 13:28:04 +0000 Received: from mail.i-mark.de ([188.138.104.222]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fvMzM-00047D-2Q for pgsql-general@lists.postgresql.org; Thu, 30 Aug 2018 13:28:02 +0000 Received: from [192.168.178.20] (unknown [185.38.49.16]) by mail.i-mark.de (Postfix) with ESMTPSA id 154FC1580186 for ; Thu, 30 Aug 2018 15:27:49 +0200 (CEST) Authentication-Results: loft7616.startdedicated.de; spf=pass (sender IP is 185.38.49.16) smtp.mailfrom=andreas@a-kretschmer.de smtp.helo=[192.168.178.20] Received-SPF: pass (loft7616.startdedicated.de: connection is authenticated) Subject: Re: Ways to deal with large amount of columns; To: pgsql-general@lists.postgresql.org References: <5B87EDDF.60602@sibvisions.com> From: Andreas Kretschmer Message-ID: Date: Thu, 30 Aug 2018 15:27:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <5B87EDDF.60602@sibvisions.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Am 30.08.2018 um 15:15 schrieb Robert Zenz: > As David said, you'd be better off having a table that looks like this (in terms > of columns): > > * MONTH > * AGENT > * CASHFLOW > > So your query to get the sum of a single agent would be looking like: > > select > sum(CHASFLOW) > where > AGENT = 'Agent' > and MONTH between values; > > It might be a little more work to create a GUI for that (or map this model to > the existing GUI) but it is much simpler to maintain and work with. agree. it is also possible to use partitioning. Regards, Andreas -- 2ndQuadrant - The PostgreSQL Support Company. www.2ndQuadrant.com