Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cJLhN-0006G6-Mn for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Dec 2016 14:47:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cJLhM-0004Wz-QI for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Dec 2016 14:47:24 +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.84_2) (envelope-from ) id 1cJLhL-0004UU-NQ for pgsql-bugs@postgresql.org; Tue, 20 Dec 2016 14:47:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cJLhI-0003tK-12 for pgsql-bugs@postgresql.org; Tue, 20 Dec 2016 14:47:22 +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 uBKEl54h029808; Tue, 20 Dec 2016 09:47:05 -0500 From: Tom Lane To: Andres Freund cc: Heikki Linnakangas , Pg Bugs , David Rowley Subject: Re: Crash with a CUBE query on 9.6 In-reply-to: <20161220072513.qmp2holifj2yqnzb@alap3.anarazel.de> References: <4846.1482176240@sss.pgh.pa.us> <8821dc7b-50e0-b983-1590-344108b20855@iki.fi> <20161220072513.qmp2holifj2yqnzb@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 19 Dec 2016 23:25:13 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <29806.1482245225.1@sss.pgh.pa.us> Date: Tue, 20 Dec 2016 09:47:05 -0500 Message-ID: <29807.1482245225@sss.pgh.pa.us> X-Pg-Spam-Score: -5.0 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Andres Freund writes: > But an observation about how the code evolved lately (partially by me, > don't get me wrong): I think we've too much smarts at execution > time. IMO deduplicating transition states and such should much rather > done at plan time, and if we do it right we'd also get rid of the uggly > way AggState->aggs is built up... I've looked at that before, and concluded that it wouldn't do that much beyond shuffling code from point A to point B. What it would do that I wouldn't like is widen the API between the planner and executor (and everything else that looks at plan trees). For instance, most of nodeAgg.c's internal structs would have to become public, creating hazards if we need to change them in a minor release. You could make an argument that having a better handle on the number of transition states would give the planner a more accurate gauge of the use of workmem in HashAgg --- but AFAICT, that is far from the number one problem we have in hashagg memory estimation, so I can't get excited about it. Not saying "no", but I think it'd be a lot of work for not much return. We have lots of other fish more worth frying. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs