查看Sql Server语句执行效率,时间的方法
2014-08-12 10:00
971 查看
This tutorial proposes 3 ways in order for you to get the Execution time of SQL Query or Stored Procedures are called or submitted to your SQL Server.
They will give you durations in microseconds and base on the execution time, you may have a deeper understand and will do some optimization for your database structure/indexing to make it runs better.
Stored Procedures Or SQL Commands Are Running On SQL Server and how long it takes for each of SQL Query/ Stored Procedure execution.
SQL Server Profiler Execution Time
As you see, all commands are in TextData column and all Execution time for each are in Duration column respectively.
?
Just replace your own SQL statements with line 2, after execute the statement, it will show the Duration in microseconds in another result panel.
Get Execution Time With Start Time And End Time
Run this SQL script on your SQL Query:
?
And below is the result set:
?
Get Execution Time With SET STATISTICS TIME
That’s all! Feel free to contribute your own solution by submitting your comments as you’re always be welcome.
- See more at: http://4rapiddev.com/sql-server/capture-and-display-execution-time-of-sql-query-in-sql-server/#sthash.OgMz1Qq4.dpuf
They will give you durations in microseconds and base on the execution time, you may have a deeper understand and will do some optimization for your database structure/indexing to make it runs better.
1. Using SQL Server Profiler
I think it’s a easiest way for you to trace/track WhichStored Procedures Or SQL Commands Are Running On SQL Server and how long it takes for each of SQL Query/ Stored Procedure execution.
SQL Server Profiler Execution Time
As you see, all commands are in TextData column and all Execution time for each are in Duration column respectively.
2. Using SQL Script with @StartTime and @EndTime parameters
The script should be run on SQL Server Management Studio Query.?
Get Execution Time With Start Time And End Time
3. Using SQL Script with SET STATISTICS TIME (Transact-SQL)
It displays the number of milliseconds required to parse, compile, and execute each statement.Run this SQL script on your SQL Query:
?
?
Get Execution Time With SET STATISTICS TIME
That’s all! Feel free to contribute your own solution by submitting your comments as you’re always be welcome.
- See more at: http://4rapiddev.com/sql-server/capture-and-display-execution-time-of-sql-query-in-sql-server/#sthash.OgMz1Qq4.dpuf
相关文章推荐
- SQL Server如何查看SQL语句的执行时间 .
- SQL Server如何查看SQL语句的执行时间
- 查看SQL语句在SQL Server上的执行时间
- sql server中如何查看执行效率不高的语句
- SQL 查看SQL语句执行效率 编译时间 执行时间 逻辑读取总次数
- SQLServer上查看SQL语句的执行时间的方法
- 查看SQL语句在SQL Server上的执行时间
- sql server中如何查看执行效率不高的语句
- 项目中调试SQLServer 方便的查看SQL语句的执行时间的方法
- 查看SQL语句在SQL Server上的执行时间
- Sql server 查看语句执行时间
- 查看SQL语句在SQL Server上的执行时间
- sql server中如何查看执行效率不高的语句
- 项目中调试SQLServer 方便的查看SQL语句的执行时间的方法
- 查看SQL语句在SQL Server上的执行时间
- SQL Server如何查看SQL语句的执行时间
- sql server中如何查看执行效率不高的语句
- SQL Server如何查看SQL语句的执行时间 (zz)
- SQL Server 查看 SQL 语句执行时间
- SQL SERVER 查看语句执行时间