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 1fYa9X-00013f-Lc for pgsql-hackers@arkaria.postgresql.org; Thu, 28 Jun 2018 16:52:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fYa9V-0007ve-TP for pgsql-hackers@arkaria.postgresql.org; Thu, 28 Jun 2018 16:52:13 +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 1fYa9V-0007vX-Iw for pgsql-hackers@lists.postgresql.org; Thu, 28 Jun 2018 16:52:13 +0000 Received: from hook.sigaev.ru ([93.180.27.50]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fYa9O-00026C-Jq for pgsql-hackers@postgresql.org; Thu, 28 Jun 2018 16:52:12 +0000 Received: from xor.sai.msu.ru (unknown [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: teodor) by hook.sigaev.ru (Postfix) with ESMTPSA id 215F9B19192; Thu, 28 Jun 2018 19:52:04 +0300 (MSK) Subject: Re: POC: GROUP BY optimization To: Tomas Vondra , Pgsql Hackers References: <7c79e6a5-8597-74e8-0671-1c39d124c9d6@sigaev.ru> <97d148b7-f3e7-1c39-07fd-74cbc66f6ec9@sigaev.ru> <6d1e0cdb-dde3-f62a-43e2-e90bbd9b0f42@2ndquadrant.com> <7edddb4f-9ddd-561d-2bde-47340f91d2a0@2ndquadrant.com> <2cb99655-7ae7-ec8d-2c74-3fea58987104@sigaev.ru> <6dddcce6-0d91-1868-794a-4d61dc5516f0@2ndquadrant.com> <523d1f60-c60c-5c8c-8cc5-c6c078970da6@2ndquadrant.com> <24c773b8-3a9a-8fe9-610d-01145758931b@sigaev.ru> <623f5e50-eeb2-1279-d30b-dc43611fb063@2ndquadrant.com> From: Teodor Sigaev Message-ID: Date: Thu, 28 Jun 2018 19:52:03 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.3 MIME-Version: 1.0 In-Reply-To: <623f5e50-eeb2-1279-d30b-dc43611fb063@2ndquadrant.com> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > I'm afraid that's a misunderstanding - my objections did not really go > away. I'm just saying my claim that we're not messing with order of > grouping keys is not entirely accurate, because we do that in one > particular case. > > I still think we need to be careful when introducing new optimizations > in this area - reordering the grouping keys by ndistinct, ORDER BY or > whatever. In particular I don't think we should commit these patches > that may quite easily cause regressions, and then hope some hypothetical > future patch fixes the costing. Those objections still stand. Pls, have a look at https://commitfest.postgresql.org/18/1706/ I tried to attack the cost_sort() issues and hope on that basis we can solve problems with 0002 patch and improve incremental sort patch. -- Teodor Sigaev E-mail: teodor@sigaev.ru WWW: http://www.sigaev.ru/