the query store sql tuning

19
Grant Fritchey | www.ScaryDBA.com www.ScaryDBA.com The Query Store and SQL Tuning Grant Fritchey – Red Gate Software

Upload: grant-fritchey

Post on 12-Apr-2017

657 views

Category:

Software


2 download

TRANSCRIPT

Grant Fritchey | www.ScaryDBA.com

www.ScaryDBA.com

The Query Store and SQL Tuning

Grant Fritchey – Red Gate Software

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

Grant Fritchey | www.ScaryDBA.com

Get in touch

scarydba.com

[email protected]

@gfritchey

Grant Fritchey

Grant Fritchey | www.ScaryDBA.com 4

Grant Fritchey | www.ScaryDBA.com 5

Grant Fritchey | www.ScaryDBA.com 6

Grant Fritchey | www.ScaryDBA.com

Query Store

7

Grant Fritchey | www.ScaryDBA.com

Query Store

8

Plan Store

RuntimeStatistics

QueryOptimization

Process

Async

QueryExecution

Async

Grant Fritchey | www.ScaryDBA.com

Query Store Data

9

Grant Fritchey | www.ScaryDBA.com

Query Store Lives

10

SQL Server 2016

Azure SQL Database

2014?

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

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

Grant Fritchey | www.ScaryDBA.com

Monitoring

13

Extended Events

Wait Statistics

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

Grant Fritchey | www.ScaryDBA.com

Plan Forcing

15

Plan Store

RuntimeStatistics

QueryOptimization

Process

Async

QueryExecution

Async

Plan forcing

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

Grant Fritchey | www.ScaryDBA.com

Get in touch

scarydba.com

[email protected]

@gfritchey

Grant Fritchey

Grant Fritchey | www.ScaryDBA.com

Questions?

18