Sql Server SET STATISTICS
Sql Server 提供 了set statistics ,用于显示sql 执行过程中所消耗的资源情况,包括time和io部分,便于dba进行sql语句性能分析。
开启io统计:
set statistics io on;
显示sql执行过程中消耗的io资源情况,包括物理读、逻辑读、预读取以及表的扫描次数
关闭io统计:
set statistics io off;
开启时间统计:
set statistics time on:
显示sql执行过程中各阶段消耗时间情况,包括sql实际执行时间、分析、编译时间
SQL Server 执行时间:
CPU 时间 = 0 毫秒,占用时间 = 0 毫秒。
SQL Server 执行时间:
CPU 时间 = 0 毫秒,占用时间 = 0 毫秒。
(1 行受影响)
(1 行受影响)
SQL Server 执行时间:
CPU 时间 = 31 毫秒,占用时间 = 40 毫秒。
SQL Server 分析和编译时间:
CPU 时间 = 0 毫秒,占用时间 = 0 毫秒。
SQL Server 执行时间:
CPU 时间 = 0 毫秒,占用时间 = 0 毫秒。
关闭时间统计:
set statistics time off;
本文来自博客园,作者:踏雪无痕2017,转载请注明原文链接:https://www.cnblogs.com/oradba/p/16601168.html