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 D24519DCC49 for ; Tue, 7 Mar 2006 11:03:03 -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 36605-03 for ; Tue, 7 Mar 2006 11:03:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from globalrelay.com (mail1.globalrelay.com [216.18.71.77]) by postgresql.org (Postfix) with ESMTP id 1C53F9DC988 for ; Tue, 7 Mar 2006 11:02:56 -0400 (AST) X-Virus-Scanned: Scanned by GRC-AntiVirus Gateway X-GR-Acctd: YES Received: from [216.160.41.114] (HELO DaveEMachine) by globalrelay.com (CommuniGate Pro SMTP 4.2.3) with ESMTP id 85182252; Tue, 07 Mar 2006 07:02:58 -0800 From: "Dave Dutcher" To: "'Chris'" , "'i.v.r.'" Cc: Subject: Re: Help understanding indexes, explain, and optimizing Date: Tue, 7 Mar 2006 09:02:58 -0600 Message-ID: <003b01c641f8$39185a70$8300a8c0@tridecap.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 In-Reply-To: <440CD673.8080208@gmail.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/57 X-Sequence-Number: 17494 Actually I think LEFT OUTER JOIN is equivalent to LEFT JOIN. The Postgres manual says that the word OUTER is optional. Either way you get "...all rows in the qualified Cartesian product (i.e., all combined rows that pass its join condition), plus one copy of each row in the left-hand table for which there was no right-hand row that passed the join condition." It sounds like the original posters problem was a less than optimal join order, and from what I understand Postgres can't reorder left joins. -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Chris Sent: Monday, March 06, 2006 6:40 PM To: i.v.r. Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Help understanding indexes, explain, and optimizing i.v.r. wrote: > Hi everyone, [Snip] > So I'm wondering what I'm doing wrong. I migrated this database from > MySQL, and on there it ran pretty fast. Have you done an 'analyze' or 'vacuum analyze' over these tables? A left outer join gets *everything* from the second table: > LEFT OUTER JOIN groups ON groups.id = locations.group_id > LEFT OUTER JOIN schools ON schools.location_id = locations.id So they will load everything from groups and schools. Maybe they should be left join's not left outer joins? -- Postgresql & php tutorials http://www.designmagick.com/ ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings