Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #12 from Microsoft/develop
Browse files Browse the repository at this point in the history
Added Azure Data Warehouse files.
  • Loading branch information
meyergm committed Apr 1, 2016
2 parents d4f99bb + e87c930 commit f28d62d
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
48 changes: 48 additions & 0 deletions Supporting/DataWarehouse/Scripts/AzureSQLDWHOLCommands.sql
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 Supporting/DataWarehouse/Scripts/Step 15 High CPU Query.sql
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

0 comments on commit f28d62d

Please sign in to comment.