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 A0625D1B37E for ; Thu, 10 Jun 2004 13:55:35 -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 37768-03 for ; Thu, 10 Jun 2004 16:55:33 +0000 (GMT) Received: from simmts6-srv.bellnexxia.net (simmts6.bellnexxia.net [206.47.199.164]) by svr1.postgresql.org (Postfix) with ESMTP id 0943ED1B1B3 for ; Thu, 10 Jun 2004 13:55:30 -0300 (ADT) Received: from localhost ([67.71.24.121]) by simmts6-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20040610165527.LLPV10364.simmts6-srv.bellnexxia.net@localhost>; Thu, 10 Jun 2004 12:55:27 -0400 Received: from sympatico.ca ([192.168.250.6]) by (8.11.6/8.11.6) with ESMTP id i5AGtRg12740; Thu, 10 Jun 2004 12:55:28 -0400 Message-ID: <40C892BA.8080704@sympatico.ca> Date: Thu, 10 Jun 2004 12:56:26 -0400 From: Jean-Luc Lachance User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en, en-us, en-gb, fr, fr-ca MIME-Version: 1.0 To: Tom Lane Cc: pgsql-performance@postgresql.org, Frank van Vugt Subject: Re: *very* inefficient choice made by the planner (regarding References: <200406101624.21739.ftm.van.vugt@foxi.nl> <40C881FE.5000301@sympatico.ca> <25304.1086883145@sss.pgh.pa.us> In-Reply-To: <25304.1086883145@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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/120 X-Sequence-Number: 7178 I agree, but it should be a simple rewrite. No? x IS NULL/IS NOT NULL AND/OR NOT EXISTS Tom Lane wrote: > Jean-Luc Lachance writes: > >>If the two statments are functionally equivalent, why can't PG rewrite >>the "NOT IN" version into the more efficient "NOT EXISTS"? > > > They're not equivalent. In particular, the behavior in the presence of > NULLs is quite different. > > regards, tom lane >