the query store and sql tuning · 2019-03-08 · the query store and sql tuning grant fritchey...
TRANSCRIPT
![Page 1: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/1.jpg)
Grant Fritchey | www.ScaryDBA.com
www.ScaryDBA.com
The Query Store and SQL Tuning
Grant Fritchey – Red Gate Software
![Page 2: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/2.jpg)
Grant Fritchey | www.ScaryDBA.com
Goal
Understand the information and mechanisms behind the Query Store
Learn how to work with and maintain the Query Store
Discover new opportunities and mechanisms for dealing with query performance tuning issues
2
![Page 3: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/3.jpg)
Grant Fritchey | www.ScaryDBA.com
Get in touch
scarydba.com
@gfritchey
Grant Fritchey
![Page 4: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/4.jpg)
Grant Fritchey | www.ScaryDBA.com 4
![Page 5: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/5.jpg)
Grant Fritchey | www.ScaryDBA.com 5
![Page 6: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/6.jpg)
Grant Fritchey | www.ScaryDBA.com 6
![Page 7: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/7.jpg)
Grant Fritchey | www.ScaryDBA.com
Query Store
7
![Page 8: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/8.jpg)
Grant Fritchey | www.ScaryDBA.com
Query Store
8
Plan Store
RuntimeStatistics
QueryOptimization
Process
Async
QueryExecution
Async
![Page 9: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/9.jpg)
Grant Fritchey | www.ScaryDBA.com
Query Store Data
9
![Page 10: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/10.jpg)
Grant Fritchey | www.ScaryDBA.com
Query Store Lives
10
SQL Server 2016
Azure SQL Database
2014?
![Page 11: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/11.jpg)
Grant Fritchey | www.ScaryDBA.com
You control…
11
Turn it on or Off
Time to flush to disk
Size of storage
Days in storage
Plans per query limit
Automatic cleanup
Capture Mode
Aggregation Interval Length
![Page 12: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/12.jpg)
Grant Fritchey | www.ScaryDBA.com 12
Qu
erie
s • Execution count
•Duration
•CPU
•Compile
Exe
cuti
on
Pla
ns • Estimated
Plan
•More than one per query
![Page 13: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/13.jpg)
Grant Fritchey | www.ScaryDBA.com
Monitoring
13
Extended Events
Wait Statistics
![Page 14: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/14.jpg)
Grant Fritchey | www.ScaryDBA.com
In-Memory OLTP
14
Exactly the same
Except
• Not persisted
• sys.sp_xtp_control_query_exec_stats
• Plan forcing can fail
• No memory grants
• Need to recompile to capture metrics
![Page 15: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/15.jpg)
Grant Fritchey | www.ScaryDBA.com
Plan Forcing
15
Plan Store
RuntimeStatistics
QueryOptimization
Process
Async
QueryExecution
Async
Plan forcing
![Page 16: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/16.jpg)
Grant Fritchey | www.ScaryDBA.com
Goal
Understand the information and mechanisms behind the Query Store
Learn how to work with and maintain the Query Store
Discover new opportunities and mechanisms for dealing with query performance tuning issues
16
![Page 17: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/17.jpg)
Grant Fritchey | www.ScaryDBA.com
Get in touch
scarydba.com
@gfritchey
Grant Fritchey
![Page 18: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/18.jpg)
Grant Fritchey | www.ScaryDBA.com
Questions?
18
![Page 19: The Query Store and SQL Tuning · 2019-03-08 · The Query Store and SQL Tuning Grant Fritchey –Red Gate Software. Grant Fritchey | Goal Understand the information and mechanisms](https://reader034.vdocuments.site/reader034/viewer/2022042919/5f61253ee0641678722183d0/html5/thumbnails/19.jpg)
Grant Fritchey | www.ScaryDBA.com
Photo Credits
Meteor
London
Flight data recorder
Undo button
19