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 E96E2D1BA1F for ; Fri, 22 Aug 2003 12:47:57 -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 74966-10 for ; Fri, 22 Aug 2003 12:47:31 -0300 (ADT) Received: from megazone.bigpanda.com (45.mufb.snfc.sffca01r18.dsl.att.net [12.103.249.45]) by svr1.postgresql.org (Postfix) with ESMTP id 7F4FCD1BB1B for ; Fri, 22 Aug 2003 12:47:25 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 89710D63F; Fri, 22 Aug 2003 08:47:30 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 7F2385C0D; Fri, 22 Aug 2003 08:47:30 -0700 (PDT) Date: Fri, 22 Aug 2003 08:47:30 -0700 (PDT) From: Stephan Szabo To: Greg Stark Cc: Subject: Re: [SQL] "SELECT IN" Still Broken in 7.4b In-Reply-To: <87k795iudk.fsf@stark.dyndns.tv> Message-ID: <20030822084029.L87297-100000@megazone.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/990 X-Sequence-Number: 42647 On 22 Aug 2003, Greg Stark wrote: > > Tom Lane writes: > > > 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. > > But time spent in the planner doesn't matter if you're using prepared queries > which is true for OLTP applications where there are very few queries being > executed many many times. I hear web sites are quite popular these days. True, but not every application is such. You still need to balance planning time with other concerns. > I missed the beginning of this thread so I'm not sure if it's relevant. But > wouldn't it be possible to just check if all the clauses and see if they're > using precisely the same index with an equality type operator? That won't > catch things like "a BETWEEN 1 AND 2 OR a BETWEEN 5 AND 6" but it will catch > things like "a IN (1,2,3,4,5,6)". And I don't see how it wouldn't be linear > in the number of clauses. But that wouldn't help unless you made sure that what was being compared was not the same AFAICT (since the point would be to not need to check if the rows were already returned) since a=1 or a=1 is legal if meaningless. And that's not necessarily immediately obvious depending on the behavior of the = operator without trying it, for example does where a='c ' or a='c' have a redundancy or not?