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 56C6BD1B379 for ; Thu, 10 Jun 2004 14:14:41 -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 48005-02 for ; Thu, 10 Jun 2004 17:14:37 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 75033D1B1A1 for ; Thu, 10 Jun 2004 14:14:36 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 56BA73538C; Thu, 10 Jun 2004 10:14:36 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 5502935388; Thu, 10 Jun 2004 10:14:36 -0700 (PDT) Date: Thu, 10 Jun 2004 10:14:36 -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: <20040610100332.D20710@megazone.bigpanda.com> Message-ID: <20040610101410.X21002@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> <20040610100332.D20710@megazone.bigpanda.com> 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/122 X-Sequence-Number: 7180 On Thu, 10 Jun 2004, Stephan Szabo wrote: > > 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 Erm that exists should have been false