清除缓存,计算Sql Server查询效率

时间:2022-10-25 03:06:12

--优化之前

DBCC FREEPROCCACHE

DBCC DROPCLEANBUFFERS

SET STATISTICS IO ON

select Dtime,Value from dbo.his20140825 WHERE Dtime>='' AND Dtime<='' AND MgrObjId='' AND Id=''

SET STATISTICS IO OFF

--优化之后

DBCC FREEPROCCACHE

DBCC DROPCLEANBUFFERS

SET STATISTICS IO ON

select Dtime,Value from dbo.his20140825 WHERE MgrObjId='' AND Id='' AND Dtime>='' AND Dtime<=''

SET STATISTICS IO OFF