X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6124C476344 for ; Wed, 23 Apr 2003 22:37:43 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id BAE09476340 for ; Wed, 23 Apr 2003 22:37:42 -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 h3O2bcU6010222; Wed, 23 Apr 2003 22:37:38 -0400 (EDT) To: josh@agliodbs.com Cc: Lorraine.Dewey@companiongroup.com (Lorraine Dewey), pgsql-sql@postgresql.org Subject: Re: Optomizing left outer joins In-reply-to: <200304231149.32514.josh@agliodbs.com> References: <200304231149.32514.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Wed, 23 Apr 2003 11:49:32 -0700" Date: Wed, 23 Apr 2003 22:37:38 -0400 Message-ID: <10221.1051151858@sss.pgh.pa.us> From: Tom Lane X-Spam-Status: No, hits=-29.3 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,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/356 X-Sequence-Number: 13057 Josh Berkus writes: > FWIW, outer joins are slower than regular joins on all RDBMSs I've tested -- > often up to 5 times slower. I'm not sure whether this is just the planner > restricitons inherent in an outer join, or whether this is something about > the required join algorithm itself. There isn't anything fundamentally slower about left join vs plain join (unless, perhaps, the left join has to generate a really large number of null-extended rows that the plain join would not generate). My money is on the left join having prevented some optimization that could be applied in the plain-join case. But since we have not been shown any exact details of the tables or the query, it's impossible to do more than wager... regards, tom lane