HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

query plan caching (sql server)

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
sqlquerycachingplanserver

Problem

Is there a measure of time frame as to which the execution plan of inline queries will cached?

Solution

There is an algorithm (will find it), but practically it will stay there:

  • while being used (Edit: See AdaTheDev's answer)



  • until statistics update (also implied by index rebuild)



  • until definition changes (including whitespace and case)



  • SQL instance restart



  • until severe memory pressure



SQL Server 2008 article

Context

StackExchange Database Administrators Q#11701, answer score: 6

Revisions (0)

No revisions yet.