Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jZvpz-0005fB-GH for pgsql-hackers@arkaria.postgresql.org; Sat, 16 May 2020 12:22:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jZvpy-0008J2-52 for pgsql-hackers@arkaria.postgresql.org; Sat, 16 May 2020 12:22:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1jZvpx-0008Iv-SB for pgsql-hackers@lists.postgresql.org; Sat, 16 May 2020 12:22:41 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1jZvpv-0000RR-Jw for pgsql-hackers@lists.postgresql.org; Sat, 16 May 2020 12:22:41 +0000 Received: by mail-wr1-x443.google.com with SMTP id w7so6412444wre.13 for ; Sat, 16 May 2020 05:22:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=aaDEXsLB8OKGCwE8HLWcOq1tFe8iFw4QJG00d7Gf5Iw=; b=kE5RcCG5Vwou0XJgxhPdGNI2+BabNE2wlT8dRf1rn3tnXaWXJG1MmVAUBMZMyTeAIz U6HfPO6kr0+ICr8GTy6H2HNQrLDDjSmEOiSwc/0FFCmoLr++uVoWzjvwspT/Yl7QPgI8 Sxjw6l0u7ho1CYGVSifwnIHjmvIuVOXBZccmsGC4MWz5hbLdq76fibd34UCQg1RY5COj JeZWzOouRCjA/WLL/3GKUmdNC4RgvhO5wu2MImcl1rFYbrd/3h8v9bMQloFuneQPNPe7 HdOjYRGbTt2LdcG5dEWxTjf0onOdZwn2NFgmfIeAI9rPeNFxB/ia0Hoq4JHtdJXwo+wM UBmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=aaDEXsLB8OKGCwE8HLWcOq1tFe8iFw4QJG00d7Gf5Iw=; b=XUbufNTH8v/ee0ZKbUtBM2yHBres0IKh66zC13zXJtuFHKcsyX67bLKBB2cEVr+usi hOtKeSkBovHFxeCPJQD1bIHON5U/NeP/7n8u2hz2yc/oNX5qHGaGFpaQaFAHBBM+N8PK cVn23dxS0SvIGNqJQ8kpAmQN2ivG6noJ9lxvWWbLgeWGkX5sR/bOxDGVLqK2Z7pLuvR5 PgGLYy6ZgWCxrS9ADAtKHIhMhZXyt0wx20tMH6GGpASZGy2WxprMnHaZxbavV5KlTGJ7 7dBMLGwB1td1f1yvpTDLRE6yp89HUXY5ogebV8VxouicBJZRznUmMu4LEgkzklS5mdqt mIAg== X-Gm-Message-State: AOAM531zXf/vLxbl1MSNoP8zcve+SaLo5k/vzDqMJuc3bRUf8aIr1cU2 k5G3A7Sk8FW4DUmqVlvUUtI= X-Google-Smtp-Source: ABdhPJyvlmfQ8duIGOYuAEh2OurfGK+ekFgv9VgadZ92t5skazKY7uu46hxaiHkQLl/9ShWrIEgucw== X-Received: by 2002:adf:fa44:: with SMTP id y4mr9721134wrr.135.1589631758230; Sat, 16 May 2020 05:22:38 -0700 (PDT) Received: from localhost (dslb-094-222-004-201.094.222.pools.vodafone-ip.de. [94.222.4.201]) by smtp.gmail.com with ESMTPSA id q144sm8041968wme.0.2020.05.16.05.22.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 May 2020 05:22:37 -0700 (PDT) Date: Sat, 16 May 2020 14:24:31 +0200 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Tomas Vondra Cc: Teodor Sigaev , Gavin Flower , Andres Freund , Michael Paquier , PostgreSQL Developers Subject: Re: POC: GROUP BY optimization Message-ID: <20200516122431.b7wtpm7dspsaxfro@localhost> References: <20181002021626.GF11712@paquier.xyz> <20190131112407.zpbysdvghjyh4z47@alap3.anarazel.de> <20190409152100.5q25whnxs27zws5m@development> <20190503215510.bcr5ycszntqg65tw@development> <20190524225725.embuha33qvc5avz3@development> <20200514235220.xewrrwjvatxzn3g6@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200514235220.xewrrwjvatxzn3g6@development> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Fri, May 15, 2020 at 01:52:20AM +0200, Tomas Vondra wrote: > > I wonder if anyone has plans to try again with this optimization in v14 > cycle? The patches no longer apply thanks to the incremental sort patch, > but I suppose fixing that should not be extremely hard. > > The 2020-07 CF is still a couple weeks away, but it'd be good to know if > there are any plans to revive this. I'm willing to spend some time on > reviewing / testing this, etc. Yes, if you believe that this patch has potential, I would love to pick it up again. > I've only quickly skimmed the old thread, but IIRC there were two main > challenges in getting the optimization right: > > > 1) deciding which orderings are interesting / worth additional work > > I think we need to consider these orderings, in addition to the one > specified in GROUP BY: > > 1) as specified in ORDER BY (if different from 1) What is the idea behind considering this ordering?