forked from microsoft/bobsql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update instructions for psp demo and show new query store DMVs
- Loading branch information
Showing
3 changed files
with
80 additions
and
29 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,10 +1,34 @@ | ||
USE WideWorldImporters; | ||
GO | ||
SELECT * FROM sys.query_store_query_text; | ||
-- Look at the queries and plans for variants | ||
-- Notice each query is from the same parent_query_id and the query_hash is the same | ||
SELECT qt.query_sql_text, qq.query_id, qv.query_variant_query_id, qv.parent_query_id, | ||
qq.query_hash,qr.count_executions, qp.plan_id, qv.dispatcher_plan_id, qp.query_plan_hash, | ||
cast(qp.query_plan as XML) as xml_plan | ||
FROM sys.query_store_query_text qt | ||
JOIN sys.query_store_query qq | ||
ON qt.query_text_id = qq.query_text_id | ||
JOIN sys.query_store_plan qp | ||
ON qq.query_id = qp.query_id | ||
JOIN sys.query_store_query_variant qv | ||
ON qq.query_id = qv.query_variant_query_id | ||
JOIN sys.query_store_runtime_stats qr | ||
ON qp.plan_id = qr.plan_id | ||
ORDER BY qv.parent_query_id | ||
GO | ||
SELECT * FROM sys.query_store_query; | ||
-- Look at the "parent" query | ||
-- Notice this is the SELECT statement from the procedure with no OPTION for variants. | ||
SELECT qt.query_sql_text | ||
FROM sys.query_store_query_text qt | ||
JOIN sys.query_store_query qq | ||
ON qt.query_text_id = qq.query_text_id | ||
JOIN sys.query_store_query_variant qv | ||
ON qq.query_id = qv.parent_query_id | ||
GO | ||
SELECT * FROM sys.query_store_plan; | ||
-- Look at the dispatcher plan | ||
-- If you "click" on the SHOWPLAN XML output you will see a "multiple plans" operator | ||
SELECT qp.plan_id, qp.query_plan_hash, cast (qp.query_plan as XML) | ||
FROM sys.query_store_plan qp | ||
JOIN sys.query_store_query_variant qv | ||
ON qp.plan_id = qv.dispatcher_plan_id | ||
GO | ||
SELECT * FROM sys.query_store_query_variant; | ||
GO |
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