X-Original-To: pgsql-performance@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1762A4762A2 for ; Thu, 17 Apr 2003 12:31:47 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id A27A3476141 for ; Thu, 17 Apr 2003 12:31:45 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h3HGVnU6011333; Thu, 17 Apr 2003 12:31:49 -0400 (EDT) To: Jonathan Moore Cc: pgsql-performance@postgresql.org Subject: Re: dum query plan: more info. In-reply-to: <1050530569.20873.120.camel@spunge-bob> References: <1050530569.20873.120.camel@spunge-bob> Comments: In-reply-to Jonathan Moore message dated "16 Apr 2003 15:02:49 -0700" Date: Thu, 17 Apr 2003 12:31:49 -0400 Message-ID: <11332.1050597109@sss.pgh.pa.us> From: Tom Lane X-Spam-Status: No, hits=-32.3 required=5.0 tests=BAYES_00,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/155 X-Sequence-Number: 1661 Jonathan Moore writes: > I now under stand that my join was rong but none of the seguestions are > the optimal solution to the problime. You can make this order n if you > try. The trick is to use a mearg join using sorted list of the unique > keys in each colum join. The question you are asking is what left hand > entrys do not exist on the right. In that case maybe what you are after is select a.* from a left join b on (a.left = b.right) where b.right is null; which is a pretty grotty hack using the outer-join rules, but should work efficiently. regards, tom lane