PWAIT_HADR_WORKITEM_COMPLETED is recorded by a thread waiting for an asynchronous Availability Group work task to complete. AG management operations frequently hand their real work to async tasks, adding a database to an AG, removing one, joining a replica, and the initiating thread parks in this wait until the work item reports back. Expected during any…
QDS_ASYNC_QUEUE is recorded when a thread waits for access to the queue of Query Store information that is being asynchronously persisted to disk. Query Store collects runtime stats in memory and stages them through this queue for background writing; the wait is the coordination around that staging. Third member of the Query Store background trio,…
The longest wait name most DBAs will ever paste into a search engine is also one of the least interesting: QDS_CLEANUP_STALE_QUERIES_TASK_MAIN_LOOP_SLEEP is recorded by the Query Store cleanup task while it sleeps between runs that remove old query information from the store. Size-based and time-based cleanup both ride this schedule. A timer between housekeeping sweeps,…
QDS_DYN_VECTOR is recorded when a thread waits for access to one of Query Store’s thread-safe internal data structures (a dynamic vector, per the name). Query Store’s in-memory machinery is shared across every session whose queries it tracks, so brief synchronisation on its structures is routine. Marked “internal use only” by the documentation, and it behaves…
QDS_LOADDB is recorded while Query Store loads its data for a database during that database’s startup, after instance restarts, failovers, crash recovery, or the database coming back online. Here is the part that bites: by default (before SQL Server 2019), that load is synchronous, and queries cannot run against the database until it finishes. The…
QDS_PERSIST_TASK_MAIN_LOOP_SLEEP is recorded by the Query Store background persistence task while it sleeps between rounds of flushing captured query metrics from memory to disk. Query Store collects runtime stats in memory and writes them out on an interval (the DATA_FLUSH_INTERVAL_SECONDS setting, 15 minutes by default); this wait is the timer between those flushes. A background…
QDS_STMT is recorded when a thread waits for access to Query Store’s map of query hashes, the structure that tracks which queries have been seen. Registering a previously-untracked query requires latching that map exclusively to add the new hash, so every genuinely new query text pays a brief serialisation. For workloads that parameterise well, new…
QRY_PROFILE_LIST_MUTEX is recorded when a thread waits for access to a profile list inside the query profiling statistics mechanism, the infrastructure behind lightweight query execution statistics (live query stats, sys.dm_exec_query_profiles, and the lightweight profiling that later versions enable by default). Mostly invisible plumbing, with one documented sharp edge. Is It a Problem? Normally no, but…
QUERY_TASK_ENQUEUE_MUTEX appears to be recorded when a thread involved in certain batch-mode query operations waits for its sibling threads to finish initialising. Batch-mode execution spins up cooperating thread sets, and their startup coordination passes through this mutex. It keeps company with the HT* family and BPSORT in the batch-mode machinery. Is It a Problem? No;…
REDO_THREAD_PENDING_WORK is recorded on an Availability Group secondary when a redo thread is waiting to be signalled that more log has arrived to apply. When the secondary is fully caught up, the redo thread has nothing to do and parks here until the primary generates more transactions. It is one of the most common top…
Always On Availability Groups (4) Auditing (7) Backups (5) Blocking Locking (6) Collectors (7) Database Backups & Recovery (8) Database Backups and Recovery (5) Database Maintenance (7) DBA Tools (24) Disk Space (5) Extended Events (8) Features (6) High Availability (6) Indexes (7) Installation (7) Instance (3) Inventory (6) Jobs (3) Maintenance (6) Migration (13) Monitoring (24) Performance (21) Performance Troubleshooting (9) PowerShell (4) Queries (3) Query Behaviour (5) Security (7) SQL Agent (5) SQL Scripts (17) SQL Server Administration (10) SQL Server Configuration (7) SQL Server Errors (5) SQL Server High Availability (4) SQL Server Internals (3) SQL Server Management Studio (SSMS) (6) SQL Server Monitoring (7) SQL Server Networking (9) SQL Server Security (7) Storage and Capacity (7) T-SQL (9) Temp DB (3) Tracing (7) Transaction Logs (4) Troubleshooting (14) Windows Server (4)