© Edward Pollack 2019
Edward PollackDynamic SQLhttps://doi.org/10.1007/978-1-4842-4318-3_8

8. Parameter Sniffing

Edward Pollack1 
Albany, NY, USA

In Chapter 6 we introduced a number of tools, methods, and tips for performance optimization. A critical component that was briefly discussed was the query plan cache. Whenever a query is executed for the first time, an execution plan is generated by the query optimizer. This process is expensive, and therefore it is beneficial to minimize the work that is performed by it. Execution plans are placed into the query plan cache when optimization is complete, where they will remain until sufficient changes occur in execution, available memory, or the underlying data to push that plan out of cache.

This process ...

Get Dynamic SQL: Applications, Performance, and Security in Microsoft SQL Server now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.