X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BBDCAD1B37A for ; Thu, 10 Jun 2004 14:09:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40610-05 for ; Thu, 10 Jun 2004 17:09:09 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 23E22D1B373 for ; Thu, 10 Jun 2004 14:09:07 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 38922358E9; Thu, 10 Jun 2004 10:09:07 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 36E00358E8; Thu, 10 Jun 2004 10:09:07 -0700 (PDT) Date: Thu, 10 Jun 2004 10:09:07 -0700 (PDT) From: Stephan Szabo To: Jean-Luc Lachance Cc: Tom Lane , pgsql-performance@postgresql.org, Frank van Vugt Subject: Re: *very* inefficient choice made by the planner (regarding In-Reply-To: <40C892BA.8080704@sympatico.ca> Message-ID: <20040610100332.D20710@megazone.bigpanda.com> References: <200406101624.21739.ftm.van.vugt@foxi.nl> <40C881FE.5000301@sympatico.ca> <25304.1086883145@sss.pgh.pa.us> <40C892BA.8080704@sympatico.ca> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/121 X-Sequence-Number: 7179 On Thu, 10 Jun 2004, Jean-Luc Lachance wrote: > I agree, but it should be a simple rewrite. No? It's NULLs inside the subselect that are the issue. select 1 in (select a from foo) select exists ( select 1 from foo where a=1) If foo.a contains a row with NULL but no rows containing a 1, the above give different results (unknown and exists) and IIRC, exists cannot return unknown, so there's no simple rewrite of the subselect that gives equivalent behavior.