Notice (8): file_put_contents(): Write of 272 bytes failed with errno=28 No space left on device [CORE/src/Log/Engine/FileLog.php, line 140]

Notice: file_put_contents() [function.file-put-contents]: Write of 1108 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): SplFileObject::fwrite() [<a href='https://secure.php.net/splfileobject.fwrite'>splfileobject.fwrite</a>]: Write of 5437 bytes failed with errno=28 No space left on device [CORE/src/Cache/Engine/FileEngine.php, line 141]

Notice: file_put_contents() [function.file-put-contents]: Write of 3153 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): unserialize() [<a href='https://secure.php.net/function.unserialize'>function.unserialize</a>]: Error at offset 94197 of 94197 bytes [APP/Controller/NewsController.php, line 5571]

Notice: file_put_contents() [function.file-put-contents]: Write of 2491 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
在SQLServer上查看SQL语句的执行时间的方法 - 站长搜索
首页 > 资讯列表 > 编程/数据库 >> 数据库操作教程

在SQLServer上查看SQL语句的执行时间的方法

数据库操作教程 2022-09-23 20:16:20 转载来源: 网络整理/侵权必删

1:下面这种是比较简单的查询方法,通过查询前的时间和查询后的时间差来计算的复制代码代码如下:declare@begin_datedatetimedeclare@end_datedatetimeselect@begin_date=getdate()<这里写上你的语句...>select@end_date=getdate()selectdatediff(ms,@begin_date,@end_date)as'用时/毫秒'2:下面这种方法比较全面,将执行每个语句时采取的步骤作为行集返回,通过层次结构树的形式展示出来复制代码代码如下:setstatisticsprofileonsetstatisticsioonsetstatisticstimeongo<这里写上你的语句...>gosetstatisticsprofileoffsetstatisticsiooffsetstatisticstimeoff有时候我们需要知道一段SQL语句执行的时间有多长。下面是其中一种办法

1:下面这种是比较简单的查询方法,通过查询前的时间和查询后的时间差来计算的

复制代码 代码如下:

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语句执行的时间有多长。下面是其中一种办法。

declare @preDate Datetimeselect @preDate = getdate()print @preDateselect datepart(ms,@preDate) as ms, datepart(ss,@preDate) as second,datepart(mi,@preDate) as minutego--需要测试的SQL语句godeclare @preDate DatetimeSELECT @preDate= getdate()select datepart(ms,@preDate) as ms, datepart(ss,@preDate) as second,datepart(mi,@preDate) as minute

这样可以知道你的语句到底运行了多少毫秒。

标签: SQLServer 查看 SQL 语句 行时 间的 方法


声明:本文内容来源自网络,文字、图片等素材版权属于原作者,平台转载素材出于传递更多信息,文章内容仅供参考与学习,切勿作为商业目的使用。如果侵害了您的合法权益,请您及时与我们联系,我们会在第一时间进行处理!我们尊重版权,也致力于保护版权,站搜网感谢您的分享!

站长搜索

http://www.adminso.com

Copyright @ 2007~2025 All Rights Reserved.

Powered By 站长搜索

打开手机扫描上面的二维码打开手机版


使用手机软件扫描微信二维码

关注我们可获取更多热点资讯

站长搜索目录系统技术支持