[jboss-user] [EJB 3.0] - Re: HQL/ JPA-QL Query Tuning: How to enforce the join order

oskar.carlstedt do-not-reply at jboss.com
Fri May 4 04:06:19 EDT 2007


anonymous wrote : This is just sick disgusting rubbish! Who ever invented that stuff - fire him! 
  | 

No, sorry, this is not "sick disgusting rubbish". As a matter of fact, the join order is of importance for many databases. One can think that a databse's execution planner should fix this, but some of them aren't.

Ok, why is the order of importance. When joining the same table with different other tables one get subsets of data that in turn will be joined again etc.

In this example whe have T1, T2 and T3. Let say a join between T1 and T2 gives 1.000.000 records in return and a join between T1 and T3 gives 1000 records in returns. Of course it is better to do the T1 and T3 join before and the make a join between result of (T1, T3) and T2. It will speed up a lot because you are cutting off most of the records in the first join.

With kind regards
Oskar

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043081#4043081

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043081



More information about the jboss-user mailing list