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 97C2132B1CA for ; Fri, 8 Oct 2004 15:22:58 +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 36347-07 for ; Fri, 8 Oct 2004 14:22:47 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 616D832B1A7 for ; Fri, 8 Oct 2004 15:22:51 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id i98EMiRm012170; Fri, 8 Oct 2004 10:22:44 -0400 (EDT) To: simon@2ndquadrant.com Cc: =?iso-8859-1?Q?Josh_Berkus?= , pgsql-performance@postgresql.org, =?iso-8859-1?Q?Gabriele_Bartolini?= , =?iso-8859-1?Q?Aaron_Werman?= Subject: Re: =?iso-8859-1?Q?Re:_Re:__Data_warehousing_requirements?= In-reply-to: <28292295$10972388454166893d146f88.44056315@config5.schlund.de> References: <28292295$10972388454166893d146f88.44056315@config5.schlund.de> Comments: In-reply-to message dated "Fri, 08 Oct 2004 14:38:01 +0200" Date: Fri, 08 Oct 2004 10:22:44 -0400 Message-ID: <12169.1097245364@sss.pgh.pa.us> From: Tom Lane 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/103 X-Sequence-Number: 8579 writes: > Unfortunately, yes thats true - thats is for correctness, not an > optimization decision. Outer joins constrain you on both join order AND > on join type. Nested loops and hash joins avoid touching all rows in > the right hand table, which is exactly what you don't want when you > have a right outer join to perform, since you wish to include rows in > that table when there is no match. Thus, we MUST choose a merge join > even when (if it wasn't an outer join) we would have chosen a nested > loops or hash. The alternative of course is to flip it around to be a left outer join so that we can use those plan types. But depending on the relative sizes of the two tables this may be a loser. If you are using a FULL join then it is indeed true that mergejoin is the only supported plan type. I don't think that was at issue here though. regards, tom lane