Re: advice on query joining 10 tables

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Gerardo Herzig <gherzig(at)fmed(dot)uba(dot)ar>
Cc: postgres list <pgsql-sql(at)postgresql(dot)org>
Subject: Re: advice on query joining 10 tables
Date: 2010-05-10 21:35:17
Message-ID: AANLkTimzy8SjmlUYWWLmr85S8xZ-hB3tUIQ49gEmjQx_@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, May 10, 2010 at 2:38 PM, Gerardo Herzig <gherzig(at)fmed(dot)uba(dot)ar> wrote:
> Scott Marlowe wrote:
>> On Mon, May 10, 2010 at 12:40 PM, Gerardo Herzig <gherzig(at)fmed(dot)uba(dot)ar> 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.

Also, search the pgsql archives for "explain analyze" for lots of
posts. You can learn quite a bit trawling the archives like that.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Torsten Zühlsdorff 2010-05-11 12:31:09 [Trigger] Help needed with NEW.* and TG_TABLE_NAME
Previous Message Gerardo Herzig 2010-05-10 20:38:18 Re: advice on query joining 10 tables