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 1o9HrC-0001vL-Is for pgsql-bugs@arkaria.postgresql.org; Thu, 07 Jul 2022 03:07:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o9HrB-0001U2-5r for pgsql-bugs@arkaria.postgresql.org; Thu, 07 Jul 2022 03:07:09 +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 1o9HrA-0001Tl-Ul for pgsql-bugs@lists.postgresql.org; Thu, 07 Jul 2022 03:07:08 +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 1o9Hr4-0008M0-8d for pgsql-bugs@lists.postgresql.org; Thu, 07 Jul 2022 03:07:07 +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 26736xv02732257; Wed, 6 Jul 2022 23:06:59 -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> Comments: In-reply-to David Rowley message dated "Thu, 07 Jul 2022 12:23:01 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2732255.1657163219.1@sss.pgh.pa.us> Date: Wed, 06 Jul 2022 23:06:59 -0400 Message-ID: <2732256.1657163219@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David Rowley writes: > I've been looking for a good excuse to commit Andy's NOT NULL patch so > that he has some more foundations for the other work he's doing. This > might be that excuse. > Does anyone think differently? While I don't have any problem with tracking column NOT NULL flags in RelOptInfo once the planner has a use for that info, I'm not sure that we have a solid use-case for it quite yet. In particular, the fact that the table column is marked NOT NULL doesn't mean that any particular occurrence of that column's Var can be freely assumed to be non-null. The patch I'm working on to label Vars that have possibly been nulled by outer joins [1] seems like essential infrastructure for doing anything very useful with the info. Maybe that objection doesn't apply to build_minmax_path's usage in particular, but that's an awfully narrow use-case. regards, tom lane [1] https://www.postgresql.org/message-id/flat/830269.1656693747@sss.pgh.pa.us