X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 95214D1BA96 for ; Thu, 21 Aug 2003 18:46:39 -0300 (ADT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 62682-05 for ; Thu, 21 Aug 2003 18:46:09 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 7F469D1B9DE for ; Thu, 21 Aug 2003 18:46:06 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h7LLk35H028349; Thu, 21 Aug 2003 17:46:03 -0400 (EDT) To: Manfred Koizar Cc: Stephan Szabo , Dani Oderbolz , pgsql-hackers@postgreSQL.org Subject: Re: [SQL] "SELECT IN" Still Broken in 7.4b In-reply-to: References: <20030821102627.C51705-100000@megazone.bigpanda.com> <25062.1061498540@sss.pgh.pa.us> Comments: In-reply-to Manfred Koizar message dated "Thu, 21 Aug 2003 23:18:04 +0200" Date: Thu, 21 Aug 2003 17:46:03 -0400 Message-ID: <28348.1061502363@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/970 X-Sequence-Number: 42627 Manfred Koizar writes: > WHERE a = 1 OR a = 2 > are totally different things. In the latter case you don't have to > check prior conditions because the conditions are mutually exclusive. > Is this reasonably easy to find out at plan creation time? Yeah, I know, but I see no easy way to verify this (where "easy" means "doesn't take an unreasonable amount of time"). A naive check would take O(N^2) time, putting you right back where you started. Even a smart check would surely take more time per item than one hashtable probe. I'm also concerned about how much the planner would have to assume about the semantics of the operators in order to prove the conditions are mutually exclusive. Finally, I suspect that once we get rid of the O(N^2) behavior in the executor, we will find that the next biggest bottleneck is in the planner; adding more work for it to do per OR-clause item will make things worse not better. regards, tom lane