X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id E5E399F9C1D for ; Wed, 3 May 2006 14:58:52 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 82051-05 for ; Wed, 3 May 2006 14:58:44 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 276E59FA195 for ; Wed, 3 May 2006 14:58:43 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k43HwbSS017794; Wed, 3 May 2006 13:58:37 -0400 (EDT) To: Mario Splivalo cc: pgsql-performance@postgresql.org Subject: Re: Lot'sa joins - performance tip-up, please? In-reply-to: <1146533274.14006.11.camel@localhost.localdomain> References: <1146533274.14006.11.camel@localhost.localdomain> Comments: In-reply-to Mario Splivalo message dated "Tue, 02 May 2006 03:27:54 +0200" Date: Wed, 03 May 2006 13:58:37 -0400 Message-ID: <17793.1146679117@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/90 X-Sequence-Number: 18877 Mario Splivalo writes: > I have a quite large query that takes over a minute to run on my laptop. The EXPLAIN output you provided doesn't seem to agree with the stated query. Where'd the "service_id = 1102" condition come from? In general, I'd suggest playing around with the join order. Existing releases of PG tend to throw up their hands when faced with a mixture of outer joins and regular joins, and just join the tables in the order listed. 8.2 will be smarter about this, but for now you have to do it by hand ... regards, tom lane