This question already has answers here:
What factors can cause Stored Procedure Recompilation on SQL Server? (3 answers)
When does a Stored Procedure recompile?(Sql Server) (3 answers)
Closed 6 days ago.
I am exploring performance tuning in SQL server and found that in SQL server best execution plan and statistics of query is stored in cache memory so just want to know that,
when SQL server run same query second time than does SQL server generate execution plan again or use execution plan that is stored in cache memory ?
If both possible than based on which criteria SQL server will decide what to do recompile or use stored execution plan ?
1条答案
按热度按时间sgtfey8w1#
According to this article :
The duration that a query plan stays in the plan cache depends upon how often a query is executed. Query plans that are used more often, stay in the query plan cache for longer durations, and vice-versa.