July 27, 2009 at 11:23 pm
Hello
I was wondering whether including an extra clause within a join will reduce the execution time of a query as opposed to adding the clause at the end of a query eg. in the where Eg:
select * from telecommunication t
inner join nametelecom nt
on t.telecode = nt.telecode
and t.telecomtype <> 1903 --Is it faster if i add the clause here
inner join name n
on nt.nameno = n.nameno
--where t.telecomtype <> 1903 --Or is it faster if i add the clause here
This isn't a major issue, i was just curious as to how sql server executes queries. I assumed that it would execute from top to bottom and results were filtered on the fly.
Eg. it would hit the 1st join and limit the results on
and t.telecomtype <> 1903
Then when it hit the 2nd join it would have less rows to join onto the name table and this should be quicker
Is this right?
Hope it all makes sense
July 28, 2009 at 3:19 am
You should check this yourself by looking at the query plans.
I suspect the plans will be the same as the optimizer should sort out the best access path.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply