Azure SQL Data Warehouse – How to Measure Query Duration

azureazure-sql-data-warehousedata-warehouse

In traditional SQL Server I can get CPU and Elapsed Time by setting the following

set statistics time on

When I try that on Azure SQL Data Warehouse I get the following error

Msg 103010, Level 16, State 1, Line 19
Parse error at line: 1, column: 5: Incorrect syntax near 'statistics'.

What options do I have for getting similar diagnostic information from SQL Data Warehouse

Best Answer

Add a label to your query using the OPTION ( LABEL ... ) syntax which is supported in Azure SQL Data Warehouse. You can then monitor it either via the portal or using the DMV sys.dm_pdw_exec_requests, for example

SELECT *
FROM dbo.yourBillionRowTable
OPTION ( LABEL = 'Your Unique Query Label 042' )


-- In a separate window...
SELECT *
FROM sys.dm_pdw_exec_requests
WHERE [label] =  'Your Unique Query Label 042'

Results: DMV

Or monitor it in the portal:

Portal