在等待 CXPACKET 完成的时间内,我查看 sys.dm_exec_requests ,发现Session的 Logical Read/Write, Physical Read 都没有变化。Waittype CXPACKET 表示SQL Server以并行方式执行Task,有一些 Task执行速度慢,有些Task执行速度快,导致执行速度快的task完成之后,等待还未完成的Task。那么,那些未完成的Task 为什么不进行IO?

利用 sys.dm_os_waiting_tasks 查看Request的所有Task,发现有一些Task 处于 IO_COMPLETION 等待,MSDN 官方文档的定义是:Occurs while waiting for I/O operations to complete. This wait type generally represents non-data page I/Os. Data page I/O completion waits appear as PAGEIOLATCH_* waits.

IO_COMPLETION 通常用于表示非数据页的IO操作(like a transaction log restore operation or the reading of bitmap pages, like the GAM page),这样看来, sys.dm_exec_requests  统计的是 Request对数据页的Logical Read/Write, Physical Read 操作。

1,引用《Causes of IO_COMPLETION and WRITE_COMPLETION SQL Server wait types》,Paul Randal 利用 Extended Event 分析 IO_COMPLETION 等待,枚举能够产生 IO_COMPLETION 等待的操作。

IO_COMPLETION:

  • Reading log blocks from the transaction log (during any operation that causes the log to be read from disk – e.g. recovery)
  • Reading allocation bitmaps from disk (e.g. GAM, SGAM, PFS pages) during many operations (e.g. recovery, DB startup, restore)
  • Writing intermediate sort buffers to disk (these are called ‘Bobs’)
  • Reading and writing merge results from/to disk during a merge join
  • Reading and writing eager spools to disk
  • Reading VLF headers from the transaction log

2,减少IO_COMPLETION 等待

通常来说,减少IO_COMPLETION 等待的方法有两种:一是将IO分散到不同的Physical Disk上,一是减少对非数据页的IO操作。

引用 Pinal Dave 的《SQL SERVER – IO_COMPLETION – Wait Type – Day 10 of 28 》

Reducing IO_COMPLETION wait:

  • Proper placing of the files is very important. We should check the file system for proper placement of files– LDF and MDF on a separate drive, TempDB on another separate drive, hot spot tables on separate filegroup (and on separate disk),etc.
  • Check the File Statistics and see if there is higher IO Read and IO Write Stall.
  • Check event log and error log for any errors or warnings related to IO.
  • It is very possible that there are no proper indexes in the system and there are lots of table scans and heap scans. Creating proper index can reduce the IO bandwidth considerably. If SQL Server can use appropriate cover index instead of clustered index, it can effectively reduce lots of CPU, Memory and IO (considering cover index has lesser columns than cluster table and all other; it depends upon the situation).

参考文档:

Causes of IO_COMPLETION and WRITE_COMPLETION SQL Server wait types

SQL SERVER – IO_COMPLETION – Wait Type – Day 10 of 28

Wait Type:IO_COMPLETION的更多相关文章

  1. SQL Server中与IO相关的等待类型:IO_COMPLETION和PAGEIOLATCH_*

    一个大的SQL语句操作,执行计划中包含了一个merge join操作,观察到SQL长时间处于IO_COMPLETION等待状态,如果是读取相关的表的数据,服务器应该全力为其服务,但是服务器的物理IO又 ...

  2. QueryRunner cannot be resolved to a type:关于包不能正常导入的问题

    在操作一个功能模块的时候,出现一个问题: 我原则是按着项目指导一步一步走的,但却出现, QueryRunner cannot be resolved to a type,这个问题应该属于Xxx can ...

  3. sklearn 调用逻辑回归函数训练数据时出现 “unknown label type:unknown”

    problemsolution:

  4. 数据源增量处理(Delta Proess)三大属性:Recod Mode、Delta Type、Serialization

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  5. 查看帮助文档的一些方法:help,dir,type,func_global等

    help与dir与type:在使用python来编写代码时,会经常使用python自带函数或模块,一些不常用的函数或是模块的用途不是很清楚,这时候就需要用到help函数来查看帮助.这里要注意下,hel ...

  6. 初识Haskell 二:基本操作符、类型Type、数据结构

    对Discrete Mathematics Using a Computer的第一章Introduction to Haskell进行总结.环境Windows 1. 在安装了ghci后,便可以进行Ha ...

  7. python 面向对象专题(六):元类type、反射、函数与类的区别、特殊的双下方法

    目录 Python面向对象06 /元类type.反射.函数与类的区别.特殊的双下方法 1. 元类type 2. 反射 3. 函数与类的区别 4. 特殊的双下方法 1. 元类type type:获取对象 ...

  8. 读书笔记:JavaScript DOM 编程艺术(第二版)

    读完还是能学到很多的基础知识,这里记录下,方便回顾与及时查阅. 内容也有自己的一些补充. JavaScript DOM 编程艺术(第二版) 1.JavaScript简史 JavaScript由Nets ...

  9. ABP源码分析二十五:EventBus

    IEventData/EventData: 封装了EventData信息,触发event的源对象和时间 IEventBus/EventBus: 定义和实现了了一系列注册,注销和触发事件处理函数的方法. ...

随机推荐

  1. VMware 克隆 Linux 系统后找不到 eth0 网卡问题(转)

    [问题描述] 使用 VMware 虚拟机的克隆功能,快速复制已安装好的 Linux 系统. 克隆完成之后,发现没有 eth0 网卡. [解决方法] 1. 编辑 /etc/udev/rules.d/70 ...

  2. android 中IntentService的作用及使用

    IntentService是继承于Service并处理异步请求的一个类,在IntentService内有一个工作线程来处理耗时操作,启动IntentService的方式和启动传统Service一样,同 ...

  3. oracle 读书笔记

    1 动态sql即拼接字符串的sql,使用变量代替具体值,10万条语句可以被hash陈一个SQL_ID,可以只解析一次 for i in 1..100000 loop execute immediate ...

  4. SAP HANA专题分析目录

    针对HANA的关键技术领域, 做深度解析. 1. HANA开发规范 HANA 各种对象的应用解析.版本管理,开发规范. 2. HANA系统管理 用户.系统权限.数据权限的深度解析. HANA系统配置. ...

  5. alfresco install in linux, and integrated with tesseract ocr

    本文描述在Linux系统上安装Alfresco的步骤: 1. 下载安装文件:alfresco-community-5.0.d-installer-linux-x64.bin 2. 增加执行权限并执行: ...

  6. 使用SQL语句逐条更新每条记录

    有些时候,我们希望同时更新表中的多条记录,但更新的值不一样. declare @i int declare @j int declare @phone varchar(20) set @j=1 sel ...

  7. js 将long型字符串转换成日期格式

    工作中难免会碰到日期的转换,往往为了方便,后台都是把时间以long型(形如1343818800000)返回给web前端.再有前端自己根据页面需求转换成相应的日期格式.这里将我常用的一个转换时间的函数贴 ...

  8. Swap Swap,即交换分区

    Swap,即交换区,除了安装Linux的时候,有多少人关心过它呢?其实,Swap的调整对Linux服务器,特别是Web服务器的性能至关重要.通过调整Swap,有时可以越过系统性能瓶颈,节省系统升级费用 ...

  9. ansible 自动化(3)

    批量执行playbooks 远程批量命令执行的另外一种方式是用playbooks:这里是playbooks的官方文档:http://docs.ansible.com/playbooks.html这里有 ...

  10. C#的winform编程入门简单介绍

    C#中事件.事件委托.事件的订阅 例子: using System.Timers; Timer t1 = new Timer(); t1.Tick += new EventHandler(XX); p ...