在等待 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. 使用github与jekyll搭建个人博客(一)

    虽然使用博客园还没有多久,但是最近看到一些大神的博客觉得很是炫酷.于是突发奇想,想要搭建自己的博客站点儿.编程菜鸟一枚,还是想要记录下最近的搭建博客经历. 使用github搭建个人博客的方式有很多,百 ...

  2. 表格里使用text-overflow后不能隐藏超出的文本的解决方法

          当把text-overflow设为ellipsis时文本溢出内容就能显示为省略标记,而设为clip时就能把文本溢出的部分裁切掉,不过在表格里面使用text-overflow后依旧不能隐藏超 ...

  3. 查看当前正在运行的activity

    找到sdk的安装路径,比如我的是 D:\prostu\Android\android-sdk\tools该路径下的: hierarchyviewer.bat 双击,可以用此工具查看设备跑的是当前的哪个 ...

  4. mySQL中删除unique key的语法

    CREATE TABLE `good_booked` (  `auto_id` int(10) NOT NULL auto_increment,  `good_id` int(11) default ...

  5. HDU-4869 Turn the pokers

    原题:  Turn the pokers       思路:假设正面为0,反面为1.牌就像这样 000000....... .考虑到假如可以实现最终反面个数为m, 牌共n张, 则这n张排任取m个为反面 ...

  6. 理解一下单片机的I2C和SPI通信

    应某位网友要求,今天说一下单片机的I2C SPI通信,可能说不清楚,因为这毕竟要做实验才可完全理解. I2C和SPI是两种不同的通信协议. 听到协议,似乎高不可攀,其实协议就是人们定义的一个标准而已, ...

  7. 记AbpSession扩展实现过程

    AbpSession只给了userId和TenantId,这次实际项目中并不够用,网上找了很久也没找到好的实现方法.项目初期没有时间进行研究,最近空了试了一下,大致实现添加额外字段并读取相应值的功能. ...

  8. 使用IronPython给.Net程序加点料

    开发的时候,经常被策划频繁变动的方案而苦恼.这时候就想要加入点动态语言来辅助一下. 在考虑用动态语言之前也曾想过使用动态加载dll的方式,实现基础接口来调用.在卸载的时候遇到了问题,虽可以通过应用程序 ...

  9. 软件工程课设day3

    下载昨日新版本程序,完成修复项目的测试. 与组内成员讨论,确认项目新模块功能“吐槽墙”的设计方向与实现形式——因为项目为便捷工具类,社区形式的实现方式与项目本质背道而驰.因此决定以“点击目标课程条目, ...

  10. 一个空行引起的阿里云负载均衡上部署https证书的问题

    今天在阿里云上购买了WoSign的https证书,在证书签发后,在控制台下载证书文件,一共有2个文件,一个是.key文件(私钥文件),一个是.pem文件(证书文件). 然后在阿里云负载均衡“证书管理” ...