文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
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段语句一起运行)。

相关阅读 更多 +
排行榜 更多 +
XLM币最具爆发力的安全交易所币安binance下载

XLM币最具爆发力的安全交易所币安binance下载

金融理财 下载
XEM币最安全隐私链的全球交易所币安binance下载

XEM币最安全隐私链的全球交易所币安binance下载

金融理财 下载
WAVES币最新上线的优质交易所币安binance下载

WAVES币最新上线的优质交易所币安binance下载

金融理财 下载