X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 562FC9DC880 for ; Sat, 17 Dec 2005 01:21:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39662-08 for ; Sat, 17 Dec 2005 01:21:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by postgresql.org (Postfix) with ESMTP id 1A98E9DC84D for ; Sat, 17 Dec 2005 01:21:55 -0400 (AST) Received: from smtp-2.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IRM004FDMWIX4@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Sat, 17 Dec 2005 18:21:54 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-173.dsl.clear.net.nz [218.101.28.173]) by smtp-2.paradise.net.nz (Postfix) with ESMTP id 334DA7D2519; Sat, 17 Dec 2005 18:21:54 +1300 (NZDT) Date: Sat, 17 Dec 2005 18:21:50 +1300 From: Mark Kirkwood Subject: Re: Should Oracle outperform PostgreSQL on a complex In-reply-to: <200512170428.jBH4S2W23715@candle.pha.pa.us> To: Bruce Momjian Cc: Simon Riggs , =?ISO-8859-1?Q?P=E5l_Stenslet?= , pgsql-performance@postgresql.org Message-id: <43A3A06E.2090900@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <200512170428.jBH4S2W23715@candle.pha.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.946 required=5 tests=[AWL=-0.386, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 0.946 X-Spam-Level: X-Archive-Number: 200512/420 X-Sequence-Number: 16241 Bruce Momjian wrote: > How are star joins different from what we do now? > > --------------------------------------------------------------------------- > Recall that a "star" query with n tables means a query where there are (n - 1) supposedly small tables (dimensions) and 1 large table (fact) - which has foreign keys to each dimension. As I understand it, the classic "tar join" is planned like this: 1) The result of the restriction clauses on each of the (small) dimension tables is computed. 2) The cartesian product of all the results of 1) is formed. 3) The fact (big) table is joined to the pseudo relation formed by 2). From what I have seen most vendor implementations do not (always) perform the full cartesion product of the dimensions, but do some of them, join to the fact, then join to the remaining dimensions afterwards. There is another join strategy called the "star transformation" where some of the dimension joins get rewritten as subqueries, then the above method is used again! This tends to be useful when the cartesion products would be stupidly large (e.g. "sparse" facts, or few restriction clauses) regards Mark P.s : Luke or Simon might have a better definition... but thought I'd chuck in my 2c... :-)