SQL Server等待事件新解

     資源等待類型  sql

    並行:CXPACKET 數據庫

    Buffer:PAGEIOLATCH_X ide

   非Buffer:LATCH_X  ui

   I/O:ASYNC_IO_COMPITION;IO_COMPITION  spa

  CPU:SOS_SCHEDULER_YIELD .net

  日誌:WRITELOG&LOGBUFFER   
  鎖阻塞:LCK_
日誌

 內存:RESOURCE_SEMAPHORE orm

 外部:PREEMPTIVE_XXXblog

 備份:DISKIO_SUSPENDE索引

等待事件: ASYNC_NETWORK_IO

 清空當前等待事件統計  :  DBCC SQLPERF ('sys.dm_os_wait_stats', CLEAR); 

       說明:  該SQL查詢有查出大量的數據行或者是大量數據,如(text 或者 varchar(max) 字段)

 

    等待事件: HADR_SYNC_COMMIT

      說明: 實時備庫可能有很耗CPU的sql

 

    等待事件: WRITELOG

      說明: 數據庫的寫入量比較大

 

    等待事件: LATCH_EX [ACCESS_METHODS_DATASET_PARENT]

     說明:查詢沒有索引,須要回表查數據

              LATCH_EX:Exclusive Latch,代表數據正在被改變或添加。兩個EX Latch不能同時保留在用一個頁上

 

      查看sys.dm_os_wait_stats的內容,你會看到LATCH_, PAGELATCH_ 和PAGEIOLATCH_打頭的Latch,

        其中LATCH_打頭的等待都是用於Non-BUF類型,

        PAGELATCH_打頭的Latch應用於各類頁,

        PAGEIOLATCH_打頭的Latch用於數據從磁盤移到RAM。

  

Other information:

A latch is a lightweight synchronization mechanism that provides synchronization between threads trying to read or change a data structure in SQL Server. There are three types of latches:

  • Latches on pages being read from disk (these are covered by the PAGEIOLATCH_XX wait types – see the PAGEIOLATCH_SH wait type for more details)
  • Latches on pages already in memory (these are covered by the PAGELATCH_XX wait types – see the PAGELATCH_EX wait type for more details)
  • Latches on non-page data structures (i.e. everything else)

The LATCH_SH and LATCH_EX wait types occur when a thread requires access to a non-page data structure (e.g., page buffers in the buffer pool (latch type = BUFFER), or the data structure that represents a database’s data and log files (latch type = FGCB_ADD_REMOVE)).

 

      https://blog.csdn.net/burgess_liu/article/details/19607151

相關文章
相關標籤/搜索