We are upgrading from 6.1b to 6.5. We have noticed that the SQL is being written differently when the query includes a self join. In 6.1b it adds the statement to the WHERE clause, in 6.5 it adds the statement to the FROM clause. I think it is in the .prm file, but I can’t figure out what is different, any ideas???
Just want to extend this question. What difference does it make if the join condition is in FROM or WHERE clause Specially with respect to performance.
Is it better to use stubby join(self join) or a complex join in which the stubby join condition on a table is specified in that table’s join with other tables
Just to clarify: Are you referring to a self-join, which is a table joined to an alias of itself, or a self-restricting join, which a stub join used to apply limits on a specific table?
Let me clarify. Suppose that there is table A which has a attributes/columns a1,a2,a3 etc. Similarly there is a table B which has attributes/columns b1,b2,b3 etc. These two table are to be joined on a1 and b1. Further from table A I should only pick those records for which a2=“1”
Now there can be two options for me.
Make a complex join between table A and table B.
A.a1=B.b1 and A.a2="1"
Make a simple join between table A and table B and use a self restricting join on table A on attribute/column a2
A.a1=B.b1
additional self restricting join on table A with condition a2="1"
In these two different scenarios the query generated is different. In first case the condition on A.a2 appears in the FROM clause whereas in the second case the condition appears in the WHERE clause.
I wanted to know the pros and cons of two approaches from the prespective of performance.