DBCC PDW_SHOWEXECUTIONPLAN
https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-pdw-showexecutionplan-transact-sql
DBCC PDW_SHOWSPACEUSED (Transact-SQL)
DBCC PDW_SHOWEXECUTIONPLAN (Transact-SQL)
Displays
the SQL Server execution plan for a query running on a specific SQL
Data Warehouse or Parallel Data Warehouse Compute node or Control node.
Use this to troubleshoot query performance problems while queries are
running on the Compute nodes and Control node.
Once
query performance problems are understood for SMP SQL Server queries
running on the Compute nodes, there are several ways to improve
performance. Possible ways to improve query performance on the Compute
nodes include creating multi-column statistics, creating non-clustered
indexes, or using query hints.
Syntax
Syntax for SQL Server:
SQL
DBCC PDW_SHOWEXECUTIONPLAN ( distribution_id, spid )
[;]
Syntax Azure Parallel Data Warehouse:
SQL
DBCC PDW_SHOWEXECUTIONPLAN ( pdw_node_id, spid )
[;]
Arguments
distribution_id
Identifier for the distribution that is running the query plan. This is an integer and cannot be NULL. Used when targeting SQL Data Warehouse.
Identifier for the distribution that is running the query plan. This is an integer and cannot be NULL. Used when targeting SQL Data Warehouse.
pdw_node_id
Identifier for the node that is running the query plan. This is an integer and cannot be NULL. Used when targeting an Appliance.
Identifier for the node that is running the query plan. This is an integer and cannot be NULL. Used when targeting an Appliance.
spid
Identifier for the SQL Server session that is running the query plan. This is an integer and cannot be NULL.
Identifier for the SQL Server session that is running the query plan. This is an integer and cannot be NULL.
Permissions
Requires CONTROL permission on SQL Data Warehouse.
Requires VIEW-SERVER-STATE permission on the Appliance.
Examples: SQL Data Warehouse
A. DBCC PDW_SHOWEXECUTIONPLAN Basic Syntax
When running on a SQL Data Warehouse instance, modify the above query to also select the distribution_id.
SQL
SELECT [sql_spid], [pdw_node_id], [request_id], [dms_step_index], [type], [start_time], [end_time], [status], [distribution_id]
FROM sys.dm_pdw_dms_workers
WHERE [status] <> 'StepComplete' and [status] <> 'StepError'
order by request_id, [dms_step_index];
This
will return the spid for each actively running distribution. If you
were curious as to what distribution 1 was running in session 375, you
would run the following command.
SQL
DBCC PDW_SHOWEXECUTIONPLAN ( 1, 375 );
Examples: Parallel Data Warehouse
B. DBCC PDW_SHOWEXECUTIONPLAN Basic Syntax
The query that is running too long is either running a DMS query plan operation or a SQL query plan operation.
If
the query is running a DMS query plan operation, you can use the
following query to retrieve a list of the node IDs and session IDs for
steps that are not complete.
SQL
SELECT [sql_spid], [pdw_node_id], [request_id], [dms_step_index], [type], [start_time], [end_time], [status]
FROM sys.dm_pdw_dms_workers
WHERE [status] <> 'StepComplete' and [status] <> 'StepError'
AND pdw_node_id = 201001
order by request_id, [dms_step_index], [distribution_id];
Based
on the results of the preceding query, use the sql_spid and pdw_node_id
as parameters to DBCC PDW_SHOWEXEUCTIONPLAN. For example, the following
command shows the execution plan for pdw_node_id 201001 and sql_spid
375.
SQL
DBCC PDW_SHOWEXECUTIONPLAN ( 201001, 375 );
See also
DBCC PDW_SHOWPARTITIONSTATS (Transact-SQL)DBCC PDW_SHOWSPACEUSED (Transact-SQL)
Comments
Post a Comment