Performance of SQL Server 2005 Query

Add OPTION (RECOMPILE) to the end of the query.

SQL Server doesn’t “sniff” the values of the variables so you will be getting a plan based on guessed statistics rather than one tailored for the actual variable values.

Leave a Comment