Do joins really improve query performance? [message #218699] |
Fri, 09 February 2007 06:36 |
itismeprasad
Messages: 2 Registered: February 2007 Location: INDIA
|
Junior Member |
|
|
i am new to databases.
during our training we were told joins improve query performance.
But recently what i heard is that joins affect query performance.
it's b'coz first it does a cross product and then implements the join....
So i am a bit confused.
please help me in clearing this doubt.......
|
|
|
|
Re: Do joins really improve query performance? [message #218711 is a reply to message #218699] |
Fri, 09 February 2007 08:34 |
smartin
Messages: 1803 Registered: March 2005 Location: Jacksonville, Florida
|
Senior Member |
|
|
This might be stretching it a bit, but one possible explanation for what the OP heard is what I've seen some application developers doing (this particular case was ASP developers).
They would use a series of nested for loops to "simulate" a join at the application layer itself, with each for loop doing a select * from a different table, and then inside the loop doing some processing where the values were equal.
In this case, simply writing the query as a single join, even if you were to then loop through that a row at a time (not good, I know), would be better than the 2, 3, or more nested for loop single table query approach.
|
|
|