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 1jJPU1-0005tA-QU for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2020 22:35:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jJPU0-0006bG-Dp for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2020 22:35:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJPU0-0006Ys-20 for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2020 22:35:44 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJPTv-000640-84 for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2020 22:35:40 +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 02VMZWRi002609; Tue, 31 Mar 2020 18:35:32 -0400 From: Tom Lane To: Tomas Vondra cc: James Coleman , Alvaro Herrera , Michael Paquier , Rafia Sabih , Peter Geoghegan , Simon Riggs , Shaun Thomas , Dmitry Dolgov <9erthalion6@gmail.com>, Alexander Korotkov , PostgreSQL Developers , Andreas Karlsson Subject: Re: [PATCH] Incremental sort (was: PoC: Partial sort) In-reply-to: <20200331215340.bbbrccbehmjb7dbx@development> References: <20200329031437.yvhogo25wdijwpqd@development> <20200330014442.chqnwfmelm3ejsgr@development> <20200330122426.wjdfpqiatv4ybui7@development> <20200331011407.vwz3ektatgqyi6vy@development> <20200331215340.bbbrccbehmjb7dbx@development> Comments: In-reply-to Tomas Vondra message dated "Tue, 31 Mar 2020 23:53:40 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2607.1585694132.1@sss.pgh.pa.us> Date: Tue, 31 Mar 2020 18:35:32 -0400 Message-ID: <2608.1585694132@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Tomas Vondra writes: > In general, I think it'd be naive that we can make planner smarter with > no extra overhead spent on planning, and we can never accept patches > adding even tiny overhead. With that approach we'd probably end up with > a trivial planner that generates just a single query plan, because > that's going to be the fastest planner. A realistic approach needs to > consider both the planning and execution phase, and benefits of this > patch seem to be clear - if you have queries that do benefit from it. I think that's kind of attacking a straw man, though. The thing that people push back on, or should push back on IMO, is when a proposed patch adds significant slowdown to queries that it has no or very little hope of improving. The trick is to do expensive stuff only when there's a good chance of getting a better plan out of it. regards, tom lane