最近重新翻看The Accidental DBA,将Troubleshooting部分稍作整理,方便以后查阅。此篇是Part 3
Part 1:The Accidental DBA:SQL Server Backup
Part 2:The Accidental DBA:Troubleshooting Performance
一、Wait Statistics Analysis
当SQL Server执行一项任务,如果它需要等待(页面释放锁、从磁盘读取页面到内存、事务日志写入),SQL Server会记录等待类型和等待时间。这些信息累积的,可以从sys.dm_os_wait_stats中查询。
如果你还没有使用过Wait Statistics,推荐你先阅读Paul’s wait stats post以及SQL Server Performance Tuning Using Wait Statistics: A Beginners Guide白皮书。
1.1、Viewing Wait Statistics
如果你执行下面语句
SELECT * FROM sys.dm_os_wait_stats ORDER BY wait_time_ms DESC