文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>详细记录sql运行时间(精确到毫秒)

详细记录sql运行时间(精确到毫秒)

时间:2010-09-27  来源:只羡鸳鸯

一、
declare @d datetime
set @d=getdate()

select top 1 id,***,***,***
from *** as t2 with (nolock)
where t2.*** = '***' and t2.*** = '***' and t2.*** = '***' AND t2.***>-1


select [语句执行花费时间(毫秒)]=datediff(ms,@d,getdate())
set @d=getdate()


select top 1 id,***,***,*** from ***.dbo.*** as t2 with (nolock)
where t2.*** = '***' and t2.ShiPY = '***' and t2.LabelPY = '***' AND t2.***=4

select [语句执行花费时间(毫秒)]=datediff(ms,@d,getdate())
set @d=getdate()

二、

SET STATISTICS profile ON
SET STATISTICS io ON
SET STATISTICS time ON
GO

--sql语句

select top 1 id,***,***,***
from *** as t2 with (nolock)
where t2.*** = '***' and t2.*** = '***' and t2.*** = '***' AND t2.***>-1

GO
SET STATISTICS profile OFF
SET STATISTICS io OFF
SET STATISTICS time OFF

这个是SQL server 中自带的。 执行完后看消息栏里面 分析很详细(注意 一定要3段语句一起运行)。

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载