SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Object Plans' cachestore (part of plan cache) due to some database maintenance or reconfigure operations.
2017-11-01 09:49:44.35 spid166 SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Object Plans' cachestore (part of plan cache) due to some database maintenance or reconfigure operations.
2017-11-01 09:49:47.85 spid166 SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'SQL Plans' cachestore (part of plan cache) due to some database maintenance or reconfigure operations.
2017-11-01 09:49:47.85 spid166 SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Bound Trees' cachestore (part of plan cache) due to some database maintenance or reconfigure operations.
数据库ERRORLOG中出现类似记录,因此去查找相关的文档,发现SQL Server在做一些配置变更时会彻底清除一次执行计划缓存,这很好的解释了许多时候修改最大内存也会导致执行计划变更,SQL执行性能变化的现象。具体的官方文档为:https://support.microsoft.com/en-us/help/917828/you-may-experience-a-decrease-in-query-performance-after-you-perform-c
但是官网也申明此类现象只在SQL Server2005SP2之前的版本出现,以后的版本已经修复,具体表现还未可知。
文档中列出了所有可能导致此种情况出现的操作:
- A database has the AUTO_CLOSE database option set to ON. When no user connection references or uses the database, the background task tries to close and shut down the database automatically.
- You run several queries against a database that has default options. Then, the database is dropped.
- A database snapshot for a source database is dropped.
Note Database snapshots are only available in Microsoft SQL Server 2005 Enterprise Edition. - You change the database state to OFFLINE or ONLINE.
- You successfully rebuild the transaction log for a database.
- You restore a database backup.
- You run the DBCC CHECKDB statement.
Note This is true only in versions of SQL Server 2005 that are earlier than SQL Server 2005 SP2. After you install SQL Server 2005 SP2 or later versions, the whole procedure cache is not flushed when you run the DBCC CHECKDB statement. - You detach a database.
- You specify one of the following options when you run the ALTER DATABASE statement:
- OFFLINE
- ONLINE
- MODIFY FILEGROUP DEFAULT
- MODIFY_NAME
- MODIFY FILEGROUP READ_WRITE
- COLLATE
- MODIFY FILEGROUP READ_ONLY
- READ_ONLY
- READ_WRITE
- The whole procedure cache is cleared if one of the following server options is changed by the RECONFIGURE statement:
- cross db ownership chaining
- index create memory (KB)
- remote query timeout (s)
- user options
- max text repl size (B)
- cost threshold for parallelism
- max degree of parallelism
- min memory per query (KB)
- query wait (s)
- min server memory (MB)
- max server memory (MB)
- query governor cost limit
建了一个数据库和编程的交流群,用于交流和提升能力,目前主要专注于Golang/Java/Python以及TiDB数据库,群号:231338927,建群日期:2019.04.26。
如发现博客错误,可直接留言指正,感谢。