--方法1【set statistic 】:
set statistics time on
go
--执行语句
xxxx
go
set statistics time off --方法2【getDate()】:
DECLARE @begin dateTime
DECLARE @end dateTime
SET @begin=getdate();
BEGIN
--执行语句
xxxx
end
set @end=getdate();
SELECT datediff(ms,@begin,@end) as 'Elapsed Time'

方法3 数据库设置

SQLServer 统计查询语句消耗时间的更多相关文章

  1. Sql server统计查询语句消耗时间

    1. set statistics time on go  xxxx go set statistics time off 2. DECLARE @begin dateTime DECLARE @en ...

  2. SqlServer 一个查询语句以致tempdb增大55G (转载)

    SqlServer 一个查询语句导致tempdb增大55G 今天操作着服务器,突然右下角提示“C盘空间不足”! 吓一跳!~ 看看C盘,还有7M!!!这么大的C盘空间怎么会没了呢?搞不好等下服务器会动不 ...

  3. SqlServer 一个查询语句导致tempdb增大55G(转载)

    SqlServer 一个查询语句导致tempdb增大55G 今天操作着服务器,突然右下角提示“C盘空间不足”! 吓一跳!~ 看看C盘,还有7M!!!这么大的C盘空间怎么会没了呢?搞不好等下服务器会动不 ...

  4. 计算 sql查询语句所花时间

    --1:下面这种是SQL Server中比较简单的查询SQL语句执行时间方法,通过查询前的时间和查询后的时间差来计算的: declare @begin_date datetimedeclare @en ...

  5. SqlServer ----- 根据查询语句创建视图

    我们都知道视图的本质就是查询语句,那么就可以根据查询语句创建视图, 前提 知道视图的组成,已经写好的sql 语句,多表或单表的查询语句,将查询语句变成视图. 所以视图可以由单表,多表或视图加表构成. ...

  6. sqlserver数据库查询语句

    --数据库所有表select * from sysobjects where type='u'; --指定表的所有列select name from syscolumns where id=(sele ...

  7. Mysql查询语句的 where子句、group by子句、having子句、order by子句、limit子句

    Mysql的各个查询语句 一.where子句   语法:select *|字段列表 from 表名 where 表达式.where子句后面往往配合MySQL运算符一起使用(做条件判断) 作用:通过限定 ...

  8. MySql 简单统计查询消耗时间脚本

    MySql 简单统计查询消耗时间脚本 by:授客 QQ:1033553122 drop procedure if exists selectTime; delimiter; create proced ...

  9. SQLSERVER读懂语句运行的统计信息

    SQLSERVER读懂语句运行的统计信息 对于语句的运行,除了执行计划本身,还有一些其他因素要考虑,例如语句的编译时间.执行时间.做了多少次磁盘读等. 如果DBA能够把问题语句单独测试运行,可以在运行 ...

随机推荐

  1. Linux学习笔记 - Shell 运算符篇

    Shell 运算符分类 Shell 和其他编程语言一样,支持多种运算符,包括: 算数运算符 关系运算符 布尔运算符 字符串运算符 文件测试运算符 算数运算符 首先,使用 shell 算数运算符是,需要 ...

  2. Xml xpath samples

    Xml: <?xml version="1.0" encoding="utf-8" ?> <Orders xmlns="http:/ ...

  3. Bash脚本编程总结

    bash脚本编程之用户交互: read [option]… [name …]  -p ‘PROMPT’  -t TIMEOUT bash -n /path/to/some_script  检测脚本中的 ...

  4. Android使用简单的Service

    首先要自定义一个Service,设定它在后台要干什么. public class MyService extends Service { @Nullable @Override public IBin ...

  5. leetcode812

    class Solution { public: double largestTriangleArea(vector<vector<int>>& points) { d ...

  6. wordpress 学习笔记

    (1) __()函数 function __( $text, $domain = 'default' ) { return translate( $text, $domain ); } 返回一个字符串 ...

  7. cxf和axis2使用有感

    CXF框架 个人不喜欢使用wsimport工具: 1.考虑到远端的服务接口发生变化,本地的接口还需要重新同步下 2.项目中无端多了些冗余的代码 这样我们选择cxf的动态调用接口吧,使用DynamicC ...

  8. 在C#中动态调用webService

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.W ...

  9. Idea的基本介绍

    Idea的基本介绍 Idea一般是作为一个Java和Scala的开发工具来使用的,它的使用方法和Eclipse有一些不同,这里记录以下一些基本点. 1.创建项目 创建一个新项目的时候,用户必须选择一个 ...

  10. MobileSubstrate

    [MobileSubstrate] Cydia Substrate (formerly called MobileSubstrate) is the de facto framework that a ...