一、
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段语句一起运行)。