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 1o9IXX-0003o5-60 for pgsql-bugs@arkaria.postgresql.org; Thu, 07 Jul 2022 03:50:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o9IXW-0000A8-0s for pgsql-bugs@arkaria.postgresql.org; Thu, 07 Jul 2022 03:50:54 +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 1o9IXV-00009h-Np for pgsql-bugs@lists.postgresql.org; Thu, 07 Jul 2022 03:50:53 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o9IXR-0000G5-Ob for pgsql-bugs@lists.postgresql.org; Thu, 07 Jul 2022 03:50:50 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 2673omca2740653; Wed, 6 Jul 2022 23:50:48 -0400 From: Tom Lane To: David Rowley cc: william.duclot@gmail.com, PostgreSQL mailing lists Subject: Re: BUG #17540: Prepared statement: PG switches to a generic query plan which is consistently much slower In-reply-to: References: <17540-7aa1855ad5ec18b4@postgresql.org> <2732256.1657163219@sss.pgh.pa.us> Comments: In-reply-to David Rowley message dated "Thu, 07 Jul 2022 15:31:30 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2740651.1657165848.1@sss.pgh.pa.us> Date: Wed, 06 Jul 2022 23:50:48 -0400 Message-ID: <2740652.1657165848@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David Rowley writes: > Anyway, I've no current plans to take the attached any further. I > think it'll be better to pursue your NULLable-Var stuff and see if we > can do something more generic like remove provably redundant NullTests > from baserestrictinfo. Yeah, I suspect that the way forward is to allow preprocess_minmax_aggregates to do what it does now, and then remove the IS NOT NULL clause again later when we have the info available to let us do that in a generic way. In any case, as you said, it's just a band-aid that happens to help in this exact scenario. It's not doing much for the bad cost estimation that's the root of the problem. regards, tom lane