数据库
首页 > 数据库> > sqlserver 清理缓存

sqlserver 清理缓存

作者:互联网

第一次执行查询后 会把数据缓存都内存所以 第二次查就会快

--清除存储过程缓存  
DBCC FREEPROCCACHE 
--清除会话缓存 
DBCC FREESESSIONCACHE 
--清除系统缓存 
DBCC FREESYSTEMCACHE('All') 
--清除所有缓存 
DBCC DROPCLEANBUFFERS
GO
 
--打开高级配置 
exec sp_configure'show advanced options', 1 
GO
--设置最大内存MB  2G
exec sp_configure 'max server memory', 2048 
EXEC ('RECONFIGURE' )
--设置执行时间
WAITFOR DELAY '00:00:10'
--设置最大内存MB  20G
EXEC  sp_configure 'max server memory', 20480 
EXEC ('RECONFIGURE' )
GO
--关闭高级配置 
exec sp_configure'show advanced options',0 
GO

 

标签:缓存,configure,--,清理,sqlserver,GO,DBCC,sp
来源: https://www.cnblogs.com/sanjinxin/p/15963403.html