Skip to content

Latest commit

 

History

History
56 lines (45 loc) · 3.17 KB

sys-dm-exec-query-parallel-workers-transact-sql.md

File metadata and controls

56 lines (45 loc) · 3.17 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs monikerRange
sys.dm_exec_query_parallel_workers (Transact-SQL)
sys.dm_exec_query_parallel_workers (Transact-SQL)
rwestMSFT
randolphwest
02/24/2023
sql
system-objects
reference
dm_exec_query_parallel_workers_TSQL
dm_exec_query_parallel_workers
sys.dm_exec_query_parallel_workers_TSQL
sys.dm_exec_query_parallel_workers
sys.dm_exec_query_parallel_workers dynamic management view
TSQL
=azuresqldb-current||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current

sys.dm_exec_query_parallel_workers (Transact-SQL)

[!INCLUDE sqlserver2016-asdb-asdbmi]

Returns worker availability information per node.

Name Data type Description
node_id int NUMA node ID.
scheduler_count int Number of schedulers on this node.
max_worker_count int Maximum number of workers for parallel queries.
reserved_worker_count int Number of workers reserved by parallel queries, plus number of main workers used by all requests.
free_worker_count int Number of workers available for tasks.

Note: every incoming request consumes at least 1 worker, which is subtracted from the free worker count. It is possible that the free worker count can be a negative number on a heavily loaded server.
used_worker_count int Number of workers used by parallel queries.

Permissions

On [!INCLUDEssNoVersion_md] and SQL Managed Instance, requires VIEW SERVER STATE permission.

On SQL Database Basic, S0, and S1 service objectives, and for databases in elastic pools, the server admin account, the Microsoft Entra admin account, or membership in the ##MS_ServerStateReader## server role is required. On all other SQL Database service objectives, either the VIEW DATABASE STATE permission on the database, or membership in the ##MS_ServerStateReader## server role is required.

Permissions for SQL Server 2022 and later

Requires VIEW SERVER PERFORMANCE STATE permission on the server.

Examples

A. Viewing current parallel worker availability

SELECT * FROM sys.dm_exec_query_parallel_workers;  

See Also

Dynamic Management Views and Functions (Transact-SQL)
Execution Related Dynamic Management Views and Functions (Transact-SQL)
sys.dm_os_workers (Transact-SQL)