SQL statement to query the current database IO waiting status

Time:2021-4-2

sys.dm_ io_ pending_ io_ Requests can return the Current IO pending status. For each pending I / O request in SQL server, a corresponding line is returned, followed by sys.dm_ io_ virtual_ file_ With stats, you can see which database IO has problems.


select DB_NAME(database_id) as DBNAME,
    database_id,
    file_id,
    io_stall,
    io_pending_ms_ticks,
    scheduler_address
from sys.dm_io_virtual_file_stats(null,null)i ,
sys.dm_io_pending_io_requests s
where s.io_handle = i.file_handle