Query Store – SQL Server 2017 vs Azure SQL Database

I love the query store, it is powerful (can be dangerous) , easy to use and packed full of information. I use it frequently across my local SQL Servers and Azure SQL Database.

Obviously it the same tool across local and cloud databases but there is one subtle difference between the two (when set to the default settings). Let’s play spot the difference.

Local SQL Server

local2017.JPG

Azure SQL Database

azureQS

So just remember the only difference when analyzing settings is the difference in Query Store Capture Mode. For Azure it is set to AUTO whereas with local installed SQL Servers it is set to ALL.

What does this mean? ALL means that it is set to capture all queries but AUTO means infrequent queries and queries with insignificant cost are ignored. Thresholds for execution count, compile and runtime duration are internally determined.

 Can You Change it?

YES YOU CAN.

Let’s try and change my SQL Server 2017 setting from All to AUTO.

ALTER DATABASE  [AdventureWorks]
SET QUERY_STORE (QUERY_CAPTURE_MODE = AUTO);
SELECT @@VERSION
SELECT query_capture_mode_desc FROM sys.database_query_store_options;

SQL2017-QS

For my Azure SQL Database I want to use mode ALL.

ALTER DATABASE  [TestDB]
SET QUERY_STORE (QUERY_CAPTURE_MODE = ALL);

SELECT @@VERSION
SELECT query_capture_mode_desc FROM sys.database_query_store_options;

SQLAZURE

By the way, if you want Query Store to stop collecting data you can switch it to mode NONE.

 

One thought on “Query Store – SQL Server 2017 vs Azure SQL Database

  1. Pingback: Query Store Capture Modes – Curated SQL

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s