Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 58EAB6329D1 for ; Mon, 10 May 2010 18:04:36 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 89962-07 for ; Mon, 10 May 2010 21:04:28 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.fmed.uba.ar (mail.fmed.uba.ar [157.92.152.1]) by mail.postgresql.org (Postfix) with ESMTP id A00F4632989 for ; Mon, 10 May 2010 18:04:28 -0300 (ADT) Received: from [157.92.152.105] (unknown [157.92.152.105]) by mail.fmed.uba.ar (Postfix) with ESMTP id D27D142D830; Mon, 10 May 2010 17:02:52 -0300 (ART) Message-ID: <4BE86EBA.3070205@fmed.uba.ar> Date: Mon, 10 May 2010 17:38:18 -0300 From: Gerardo Herzig User-Agent: Thunderbird 2.0.0.6 (X11/20070801) MIME-Version: 1.0 To: Scott Marlowe CC: postgres list Subject: Re: advice on query joining 10 tables References: <4BE8530C.6030605@fmed.uba.ar> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.011 tagged_above=-5 required=5 tests=BAYES_40=-0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201005/36 X-Sequence-Number: 34084 Scott Marlowe wrote: > On Mon, May 10, 2010 at 12:40 PM, Gerardo Herzig wrote: >> Hi all. Im triyng to see if i can improve the performance of a query >> (mainly a 10 table join) >> >> 1) Besides of triyng to use indexes, there is some rules of thumb to follow? > > log long running queries for later analysis? > >> 2) Should i try to join the bigger tables last in the query? > > The query planner can do that for you automatically. > >> 3) There is some place for understanding EXPLAIN better? > > http://explain.depesz.com/ > > Here and the docs? I've found it pretty easy to post one here and ask > for help and get it on why a query isn't running well. Note that > explain analyze is much preferred to plain explain. > Well, thanks Tom and Scott for the answers. I will take some more time reading the docs. Im looking more to know better, rather than just waiting to someone to point out my errors. By the way, that site is cute! Thanks again! Gerardo