Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qRo3d-003AbJ-VB for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Aug 2023 06:13:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qRo3b-004Kgu-2t for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Aug 2023 06:13:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qRo3a-004Kgm-Ov for pgsql-bugs@lists.postgresql.org; Fri, 04 Aug 2023 06:13:03 +0000 Received: from mail.proses.de ([87.234.246.173]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qRo3X-000Rq4-MA for pgsql-bugs@lists.postgresql.org; Fri, 04 Aug 2023 06:13:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quipsy.de; s=seg; t=1691129576; bh=8gMh2i8uqTALXk/NbkW7G9tQBs4TrQuRqa8E5W4WUWw=; h=From:To:CC:Subject:Date:References:In-Reply-To; b=TOcXJhErDxtaVoJPvX7i3o3M5sO2tw2QQ+JACcoufAnh3G3w08HSiE0qAB2K4Lp2b t5BWTeV335hUCHBb7wG+Ww83e4Wwd6+pC2O5tc9IH/RkY8deoaGhrbA6Lr2rEX60Dd r8zKqajwuY5kKv5e0Iz0oJv9JhumnRcYqjtI7VQVFXO+Hiz3K0e5qwcM6/hKdo6rbq jLC5G1AM7Jqinyw+nznN/azuypMOJEDG3q39iOjT6kDuDvzxCJSjw+1zyhN5KelxeD m1/0Wn0wckci1SBHtwTNVobXTF8Zdpchwp0dMzZg66DPYoGzQGVFVpXvIDdRqkIWP8 ff3pj/ByKb52w== Received: from ProSeS-MX2016.proses.de (Not Verified[10.147.37.34]) by mail.proses.de with Trustwave SEG (v10,0,1,2030) id ; Fri, 04 Aug 2023 08:12:56 +0200 Received: from ProSeS-MX2016.proses.de (10.147.37.34) by ProSeS-MX2016.proses.de (10.147.37.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.2242.10; Fri, 4 Aug 2023 08:12:55 +0200 Received: from ProSeS-MX2016.proses.de ([::1]) by ProSeS-MX2016.proses.de ([::1]) with mapi id 15.01.2242.010; Fri, 4 Aug 2023 08:12:55 +0200 From: "[Quipsy] Markus Karg" To: Tom Lane CC: "pgsql-bugs@lists.postgresql.org" Subject: AW: WHERE column = X AND column = Y will always be zero matching rows Thread-Topic: WHERE column = X AND column = Y will always be zero matching rows Thread-Index: AdnGFY1ZyFwM9s1qTQibB1h7OxfWUwADeimAAB2lgCA= Date: Fri, 4 Aug 2023 06:12:55 +0000 Message-ID: <0e20d207845f41609f91ce499c08c759@quipsy.de> References: <1e15568107854a75ae8dd35a5a75daa7@quipsy.de> <3497515.1691085559@sss.pgh.pa.us> In-Reply-To: <3497515.1691085559@sss.pgh.pa.us> Accept-Language: de-DE, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.147.32.78] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-SEG-SpamProfiler-Analysis: v=2.4 cv=L6yj/8f8 c=1 sm=1 tr=0 ts=64cc96e8 a=hljXQ6ALYVQa6Cx5z6SxUg==:117 a=xqWC_Br6kY4A:10 a=O53yQbXMW-gA:10 a=8nJEP1OIZ-IA:10 a=UttIx32zK-AA:10 a=epTmVMiNAAAA:8 a=-LDld3hjTDZvGo4bJJsA:9 a=wPNLvfGTeEIA:10 a=ndEWmUVY6Yapc0oHF_P4:22 X-SEG-SpamProfiler-Score: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Tom, thanks a lot for your kind explanation, this was very interesting to read! In fact, I have missed the "never executed" marks. BTW, I did not "complain". I just noticed something and was unclear if this= is a bug or not, and I clearly told so in the opening of my posting. It wa= s definitively not my intention to bother or annoy anybody, actually. Sorry= to have troubled so many in this mailing list. -Markus -----Urspr=FCngliche Nachricht----- Von: Tom Lane =20 Gesendet: Donnerstag, 3. August 2023 19:59 An: [Quipsy] Markus Karg Cc: pgsql-bugs@lists.postgresql.org Betreff: Re: WHERE column =3D X AND column =3D Y will always be zero matchi= ng rows "[Quipsy] Markus Karg" writes: > (In the following X and Y are literals; X <> Y) I noticed is that... > EXPLAIN SELECT column FROM Table WHERE column =3D X AND column =3D Y=20 > ...says that PostgreSQL actually wants to perform a Scan! You should learn to read plans before complaining about them. What you actually get is something like regression=3D# explain analyze select * from tenk1 where hundred =3D 42 and= hundred =3D 99; QUERY PLAN = =20 ---------------------------------------------------------------------------= -------------------------- Result (cost=3D5.04..224.95 rows=3D1 width=3D244) (actual time=3D0.001..0= .002 rows=3D0 loops=3D1) One-Time Filter: false -> Bitmap Heap Scan on tenk1 (cost=3D5.04..224.95 rows=3D1 width=3D244= ) (never executed) Recheck Cond: (hundred =3D 42) -> Bitmap Index Scan on tenk1_hundred (cost=3D0.00..5.04 rows=3D= 100 width=3D0) (never executed) Index Cond: (hundred =3D 42) Planning Time: 0.148 ms Execu= tion Time: 0.046 ms (8 rows) See the "never executed" markings? The one-time filter prevents anything b= elow the Result from actually doing anything.