SQL Server如何查看SQL语句的执行时间
2013-04-11 16:55
645 查看
在SQL Server数据库中,如何才能查看SQL语句的执行时间呢?本文将为您介绍查询方法,供您参考,希望对您能够有所帮助。
下面这种是SQL Server中比较简单的查询SQL语句执行时间方法,通过查询前的时间和查询后的时间差来计算的:
declare @begin_date datetime
declare @end_date datetime
select @begin_date = getdate()
<这里写上你的语句...>
select @end_date = getdate()
select datediff(ms,@begin_date,@end_date) as '用时/毫秒'
2:下面这种方法比较全面,将执行每个语句时采取的步骤作为行集返回,通过层次结构树的形式展示出来
set statistics profile on
set statistics io on
set statistics time on
go
<这里写上你的语句...>
go
set statistics profile off
set statistics io off
set statistics time off
下面这种是SQL Server中比较简单的查询SQL语句执行时间方法,通过查询前的时间和查询后的时间差来计算的:
declare @begin_date datetime
declare @end_date datetime
select @begin_date = getdate()
<这里写上你的语句...>
select @end_date = getdate()
select datediff(ms,@begin_date,@end_date) as '用时/毫秒'
2:下面这种方法比较全面,将执行每个语句时采取的步骤作为行集返回,通过层次结构树的形式展示出来
set statistics profile on
set statistics io on
set statistics time on
go
<这里写上你的语句...>
go
set statistics profile off
set statistics io off
set statistics time off
相关文章推荐
- SQL Server如何查看SQL语句的执行时间
- SQL Server如何查看SQL语句的执行时间 (zz)
- SQL Server如何查看SQL语句的执行时间
- SQL Server如何查看SQL语句的执行时间
- SQL Server如何查看SQL语句的执行时间 .
- MSSQL 如何查看SQL语句的执行时间(判断SQL语句的效率)
- 查看SQL语句在SQL Server上的执行时间
- 如何查看django执行的sql语句及消耗时间
- [SQL] sql server中如何查看执行效率不高的语句
- 查看SQL语句在SQL Server上的执行时间
- sql中的系统表sysobjects以及如何查看sql语句的执行时间
- 如何在sqlplus中查看oracle数据库sql语句执行计划,执行时间和统计信息
- [转]如何在sql2005里简单查看sql语句的执行时间和IO读写
- 查看SQL语句在SQL Server上的执行时间
- 查看SQL语句在SQL Server上的执行时间
- SQL Server 查看 SQL 语句执行时间
- mysql 如何查看sql语句执行时间和效率
- mysql 如何查看sql语句执行时间和效率
- 查看SQL语句在SQL Server上的执行时间
- 查看mysql连接数 sql语句执行时间