[SQL] advice on query joining 10 tables

2010-05-10 Thread Gerardo Herzig
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? 2) Should i try to join the bigger tables last in the query? 3) There is some place for understanding EXPLAIN better? Thanks

Re: [SQL] advice on query joining 10 tables

2010-05-10 Thread Tom Lane
Gerardo Herzig writes: > Hi all. Im triyng to see if i can improve the performance of a query > (mainly a 10 table join) One easy thing to try is increase from_collapse_limit and/or join_collapse_limit to 10 or more. That will result in longer planning time but might let the planner find a bette

Re: [SQL] advice on query joining 10 tables

2010-05-10 Thread Scott Marlowe
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 tr

Re: [SQL] advice on query joining 10 tables

2010-05-10 Thread Gerardo Herzig
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 la

Re: [SQL] advice on query joining 10 tables

2010-05-10 Thread Scott Marlowe
On Mon, May 10, 2010 at 2:38 PM, Gerardo Herzig wrote: > 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