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 1oan5w-00032S-72 for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Sep 2022 23:56:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oan5u-00048s-WA for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Sep 2022 23:56:03 +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 1oan5u-00048j-Nw for pgsql-bugs@lists.postgresql.org; Tue, 20 Sep 2022 23:56:02 +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 1oan5s-00049N-Jr for pgsql-bugs@lists.postgresql.org; Tue, 20 Sep 2022 23:56:01 +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 28KNtxjH946196; Tue, 20 Sep 2022 19:55:59 -0400 From: Tom Lane To: Jeff Janes cc: sindysenorita@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17618: unnecessary filter column <> text even after adding index In-reply-to: <739953.1663701274@sss.pgh.pa.us> References: <17618-7a2240bfaa7e84ae@postgresql.org> <349136.1663601052@sss.pgh.pa.us> <739953.1663701274@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Tue, 20 Sep 2022 15:14:34 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <946194.1663718159.1@sss.pgh.pa.us> Date: Tue, 20 Sep 2022 19:55:59 -0400 Message-ID: <946195.1663718159@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > I wonder if that isn't backwards, ie we should prefer to put duplicates > in bitmapqualorig (the recheck condition) instead of qpqual (the filter). > If my head is screwed on correctly today, that should allow us to skip > checking the condition much of the time, and the skip would be safe > if the index is correctly asserting that no recheck is needed. Flipping the removal around has the effect I expected on the plan shape, but some of the regression test queries now give the wrong answer, so there's something faulty about that analysis. regards, tom lane