This repository has been archived by the owner on Jul 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
Supporting/DataWarehouse/Scripts/AzureSQLDWHOLCommands.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/*Step 23 Retrieve Connection information*/ | ||
|
||
SELECT * FROM sys.dm_pdw_nodes_exec_connections; | ||
SELECT * FROM sys.dm_pdw_nodes_exec_sessions; | ||
|
||
/*Step 24 Retrieve Current Connection information*/ | ||
|
||
SELECT * | ||
FROM sys.dm_pdw_nodes_exec_connections AS c | ||
JOIN sys.dm_pdw_nodes_exec_sessions AS s | ||
ON c.session_id = s.session_id | ||
WHERE c.session_id = @@SPID; | ||
|
||
/*Step 25 View Running Queries*/ | ||
|
||
SELECT * FROM sys.dm_pdw_exec_requests WHERE status = 'Running'; | ||
|
||
SELECT * FROM sys.dm_pdw_exec_requests ORDER BY total_elapsed_time DESC; | ||
|
||
/*Step 26 View queries waiting for resources*/ | ||
|
||
SELECT waits.session_id, | ||
waits.request_id, | ||
requests.command, | ||
requests.status, | ||
requests.start_time, | ||
waits.type, | ||
waits.object_type, | ||
waits.object_name, | ||
waits.state | ||
FROM sys.dm_pdw_waits waits | ||
JOIN sys.dm_pdw_exec_requests requests | ||
ON waits.request_id=requests.request_id | ||
ORDER BY waits.object_name, waits.object_type, waits.state; | ||
|
||
/*Step 27 View long running Query*/ | ||
|
||
SELECT * FROM sys.dm_pdw_request_steps | ||
WHERE request_id = 'QID<request_ID Number>' | ||
ORDER BY step_index; | ||
|
||
/*Step 28 View total elapsed time for long-running query*/ | ||
|
||
SELECT * FROM sys.dm_pdw_sql_requests | ||
WHERE request_id = 'QID<request_ID Number>' AND step_index = <Step Index>; | ||
|
||
|
||
|
19 changes: 19 additions & 0 deletions
19
Supporting/DataWarehouse/Scripts/Step 15 High CPU Query.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
SELECT | ||
SalesOrderNumber as SalesOrderNumber, | ||
CustomerKey as CustomerKey, | ||
COUNT(OnlineSalesKey) as OnlineSalesKey, | ||
AVG(SalesQuantity) as SalesQuantity, | ||
AVG(SalesAmount) as SalesAmount, | ||
AVG(DiscountAmount) As DiscountAmount, | ||
AVG(DiscountQuantity) As DiscountQuantity, | ||
AVG(UnitCost) as UnitCost, | ||
AVG(UnitPrice) as UnitPrice, | ||
AVG((SalesAmount-DiscountAmount)) As SalesAmountDifference, | ||
AVG((SalesQuantity - DiscountQuantity)) as SalesQuantityDifference | ||
FROM | ||
FactSales | ||
GROUP BY | ||
SalesOrderNumber, | ||
CustomerKey | ||
HAVING | ||
AVG(SalesQuantity) > 2 |