X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 593BF32B43A for ; Sat, 9 Oct 2004 04:18:17 +0100 (BST) 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 45260-06 for ; Sat, 9 Oct 2004 03:18:13 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 7BCA632B414 for ; Sat, 9 Oct 2004 04:18:01 +0100 (BST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1CG7jm-0000v3-00; Fri, 08 Oct 2004 23:17:38 -0400 To: mmurrain@dbdes.com Cc: "Thomas F.O'Connell" , CHRIS HOOVER , sad@bankir.ru, pgsql-sql@postgresql.org Subject: Re: help on a query References: <4166AFF9.1000603@murrain.net> In-Reply-To: <4166AFF9.1000603@murrain.net> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 08 Oct 2004 23:17:38 -0400 Message-ID: <87sm8o4m25.fsf@stark.xeocode.com> Lines: 13 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 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: 200410/54 X-Sequence-Number: 19157 Michelle Murrain writes: > The OUTER JOIN version is quite a bit more efficient (by an order of magnitude) > than the option with WHERE NOT EXISTS subquery. This is going to be heavily dependent on the version of postgres. IN/NOT IN execution has improved a lot in 7.4 and later. If you're still on 7.3 then the outer join will be better. But in 7.4 I would actually expect the NOT IN or the NOT EXISTS to be faster. -- greg