August 13, 2008 at 9:02 am
Can't seem to find the previous thread that was talking about this, but if I'm using field1 <= @somevariable in my JOIN, am I causing the same issues as using field1< dateadd(dd,-1,getdate()), where SQL has to scan the table and evaluate every field1 value prior to returning data?
---------------------------------------------------------
How best to post your question[/url]
How to post performance problems[/url]
Tally Table:What it is and how it replaces a loop[/url]
"stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."
August 13, 2008 at 9:40 am
Neither should cause a table scan because you don't have a function on the column. If's functions on the columns that prevent index usage.
You may be prone to parameter sniffing with the variable (actually, lack thereof) as the optimiser doesn't know the value and has to guess as to the number of rows returned.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply