測試sql語句執行速度

DBCC DROPCLEANBUFFERS  --清除緩衝區
DBCC FREEPROCCACHE  --刪除計劃高速緩存中的元素
SET STATISTICS io ON
SET STATISTICS time ON
        Go
  ---你要測試的sql語句
SELECT a.RecTime,a.PID,a.TagID,b.TagName,a.PV,c.CompanyName,d.Name AS DataType,b.Position,e.Name ,
       f.PName,f.DeviceCode,a.AlarmStatus,a.AlarmLimits
FROM t_SM_HisData_00001 AS a 
LEFT JOIN dbo.t_CM_PointsInfo AS b ON b.TagID = a.TagID
LEFT JOIN t_CM_PDRInfo AS c ON c.PID = a.PID
LEFT join t_CM_ValueType d on b.DataTypeID = d.DataTypeID 
LEFT JOIN t_cm_monitorPosition e ON e.MPID = b.MPID
LEFT JOIN dbo.t_DM_DeviceInfo f ON f.DID = b.DID

go
SET STATISTICS profile OFF
SET STATISTICS io OFF
SET STATISTICS time OFF

相關文章
相關標籤/搜索