Database performance: Hint to SQL Server to recompile a query

SQL Server will compile queries and stored procedures, according to the given parameters.
As a result, subsequent calls with different parameters, may under-perform, because the query is not recompiled. This is especially relevant when using stored procedures.

Performance can be improved, by hinting to SQL Server to recompile the query:

OPTION (RECOMPILE)

reference: http://technet.microsoft.com/en-us/library/ms181714.aspx

Comments