SQL 语句执行时间及IO情况查看

CHECKPOINT
GO
DBCC FREEPROCCACHE 
GO
DBCC DROPCLEANBUFFERS 
GO
DBCC FREESYSTEMCACHE('ALL') ;
GO
SET Statistics IO ON
GO
SET Statistics TIME ON
GO
declare @b datetime,@e datetime
set @b =getdate()
select * from tb
set @e =getdate()
select datediff(ms,@b,@e)
SET Statistics IO OFF
GO
SET Statistics TIME OFF
GO
DBCC DROPCLEANBUFFERS 
從緩衝集區中移除所有的清除緩衝區
DBCC FREEPROCCACHE

你可能感兴趣的:(sql,Go)