Query Recompilation
摘要
In order to minimize the overhead from compiling execution plans, the plans are stored in a memory space called the plan cache. When prepared statements, whether as stored procedures or the other mechanisms for creating parameterized queries, are used, the process takes advantage of the plans being in cache. However, a number of things can cause plans to be removed from cache. Sometimes, this is a good thing. Either data has changed, statistics have been updated, or something has happened so a different execution plan may enhance performance. Sometimes, this is a bad thing, and you get a lot of recompiles, placing excessive load on the processor and interfering with the general good behavior of queries on the system. This chapter covers the following topics: