What is PAGEIOLATCH_SH wait type in SQL Server?

前端 未结 2 1447
有刺的猬
有刺的猬 2020-12-04 08:48

I have a query that is taking a long time in the middle of a transaction. When I get the wait_type of the process it is PAGEIOLATCH_SH.

Wh

相关标签:
2条回答
  • 2020-12-04 09:15

    From Microsoft documentation:

    PAGEIOLATCH_SH

    Occurs when a task is waiting on a latch for a buffer that is in an I/O request. The latch request is in Shared mode. Long waits may indicate problems with the disk subsystem.

    In practice, this almost always happens due to large scans over big tables. It almost never happens in queries that use indexes efficiently.

    If your query is like this:

    Select * from <table> where <col1> = <value> order by <PrimaryKey>
    

    , check that you have a composite index on (col1, col_primary_key).

    If you don't have one, then you'll need either a full INDEX SCAN if the PRIMARY KEY is chosen, or a SORT if an index on col1 is chosen.

    Both of them are very disk I/O consuming operations on large tables.

    0 讨论(0)
  • 2020-12-04 09:35

    PAGEIOLATCH_SH wait type usually comes up as the result of fragmented or unoptimized index.

    Often reasons for excessive PAGEIOLATCH_SH wait type are:

    • I/O subsystem has a problem or is misconfigured
    • Overloaded I/O subsystem by other processes that are producing the high I/O activity
    • Bad index management
    • Logical or physical drive misconception
    • Network issues/latency
    • Memory pressure
    • Synchronous Mirroring and AlwaysOn AG

    In order to try and resolve having high PAGEIOLATCH_SH wait type, you can check:

    • SQL Server, queries and indexes, as very often this could be found as a root cause of the excessive PAGEIOLATCH_SH wait types
    • For memory pressure before jumping into any I/O subsystem troubleshooting

    Always keep in mind that in case of high safety Mirroring or synchronous-commit availability in AlwaysOn AG, increased/excessive PAGEIOLATCH_SH can be expected.

    You can find more details about this topic in the article Handling excessive SQL Server PAGEIOLATCH_SH wait types

    0 讨论(0)
提交回复
热议问题