November 20, 2007 at 5:58 am
Well, basically, if you don't need a join, don't use one. Even if there are no rows, the engine needs to look at the table to determine the fact that there are no rows. If you have to have two different queries to satisfy two different business requirements even though there is only a relatively small difference between them, it's usually better to have two of them. Just be sure that the performance hit is worth the effort. Test it both ways, watching the query plan (scans instead of seeks, lookup operations) and the I/O.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
November 21, 2007 at 6:42 am
I agree, usually the optimiser is clever enough to know what to do - however experience tells me this is not always the case so you should just check the created plans to be sure.
[font="Comic Sans MS"]The GrumpyOldDBA[/font]
www.grumpyolddba.co.uk
http://sqlblogcasts.com/blogs/grumpyolddba/
Viewing 2 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply