您的位置:首页 > 博客中心 > 数据库 >

sql语句的效率测试

时间:2022-03-10 16:59

1.测试sql语句执行时间的方法,获得时间差

declare @end_date datetime
select @begin_date = getdate()
--要执行的sql语句
select @end_date = getdate()
select datediff(ms,@begin_date,@end_date) as ‘用时/毫秒‘
2.下面这种方法比较全面,将执行每个语句时采取的步骤作为行集返回,通过层次结构树的形式展示出来,输出中包含的列:
SET STATISTICS io ON
SET STATISTICS time ON
go
--要执行的sql语句
go
SET STATISTICS profile OFF
SET STATISTICS io OFF
SET STATISTICS time OFF

sql语句的效率测试,gxlsystem

热门排行

今日推荐

热门手游