July 24, 2003 09:24 PM

Why Do Similar Queries Have Different Execution Plans?

Rating: (0)
SQL Server Magazine
InstantDoc ID #39444

I'm having a performance problem when I try to use datetime values in a query's WHERE clause. Performance is fine when I use a literal string that represents the datetime value:

SELECT * FROM BigTable WHERE 
TargetDate > '2003-03-01'

But the query slows down when I reference a variable:

SELECT * FROM BigTable WHERE 
TargetDate > @TestDate

Why is the second query much slower than the first?

...

...This article is for paid Professional Members only.

Already a Professional Member? Please log in now:

NOT A PROFESSIONAL MEMBER? YOU CHOOSE:

Professional Membership

Monthly

Annual

VIP Membership

Monthly

Annual

Add a Comment

There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here
GOOGLE LINKS
SPONSORED LINKS
FEATURED LINKS