Get SQL run time

Here are some ways to get our sql run time

  1. This way will more comprehensive
set statistics profile on
set statistics io on
set statistics time on
go
......--your sqls
go
set statistics profile off
    2.
declare @begin_date datetime
declare @end_date datetime
select @begin_date = getdate()  --also can use [set]
......--your sqls
select @end_date = getdate()  --also can use [set]
select datediff(ms,@begin_date,@end_date) as 'time'

Here we can refer to DATEDIFF
Let use it in our actual work jobs~~

發佈了27 篇原創文章 · 獲贊 4 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章