测试SQL语句执行时间

一、第一种测试 

declare @d datetime

set @d=getdate()
select COUNT(0) from Disease
--select * from Disease
select [语句执行花费时间(毫秒)]=datediff(ms,@d,getdate())

 http://space.itpub.net/9671084/viewspace-255613

聚集索引是如此的重要和珍贵,所以笔者总结了一下,一定要将聚集索引建立在:
1、您最频繁使用的、用以缩小查询范围的字段上;
2、您最频繁使用的、需要排序的字段上。 

二、第二种测试 

set statistics profile on
set statistics time on 
go
SQL语句
go
set statistics profile off
set statistics time off 

 

and LENGTH(password)='6 
and LEFT(password,1)='m  
union Select 1,username,password from user

into outfile 'c:/file.txt   

原文地址:https://www.cnblogs.com/leeolevis/p/1962552.html