MSQL_DQ Wait Type in SQL Server

⏳Part of the SQL Server Wait Types Library, every wait type explained.Related deep dive: ASYNC_NETWORK_IO Wait TypeRelated pillar: Performance & Troubleshooting

Is It a Problem?

It is honest accounting of remote time, so it matters as much as your workload depends on distributed queries. Sustained, it means sessions spend real time waiting on a remote server, and users feel that directly. The fix is rarely local: the time is in the remote execution, the network, or the number of rows crossing the link. It was zero on our SQL Server 2025 lab. Get Wait Statistics does not filter it out, so if it ranks, you will see it.


What It Means

Microsoft’s definition: a task waiting for a distributed query operation to finish, also used to detect potential MARS application deadlocks; the wait ends when the distributed call finishes. Examples include fetching a remote rowset as input to a local sort, running sp_testlinkedserver, and fetching remote statistics while compiling a plan. Read it with OLEDB, which covers the provider calls themselves.


When It Does Matter

When it ranks, catch the distributed queries while they run:

SELECT
    r.session_id,
    r.wait_type,
    r.wait_time AS wait_ms,
    s.login_name,
    s.program_name,
    t.text AS running_sql
FROM sys.dm_exec_requests AS r
JOIN sys.dm_exec_sessions AS s ON s.session_id = r.session_id
OUTER APPLY sys.dm_exec_sql_text(r.sql_handle) AS t
WHERE r.wait_type LIKE N'MSQL_DQ'
ORDER BY r.wait_time DESC;

Get their plans and look for remote operators pulling large rowsets, the classic case being a whole remote table dragged across to be filtered locally. Push the work to the source, for example with OPENQUERY and the full filtered query, tune the remote query as its own job, and stage remote data locally for recurring pulls. The baseline to monitor is its average wait per call. The query needs VIEW SERVER STATE.


The EXTERNAL Family

These waits are SQL Server waiting on code or servers outside itself: OLE DB providers, distributed queries and extended stored procedures. The time is spent in the external code. If one is near the top of your waits, read it next to the waits that usually matter.

  • OLEDBOLE DB calls. The duration of calls to the SQL Server OLE DB provider, for linked servers and some DBCC work.Worth a look when it climbs
  • MSQL_DQDistributed queries. Waiting for a distributed query operation to finish.Worth investigating. This page.
  • MSQL_XPExtended procedures. Waiting for an extended stored procedure to end.Worth a look when it climbs

Where To Go Next

If MSQL_DQ is climbing, these are the next places to look.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *