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
Azure SQL Database
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;
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;
By the way, if you want Query Store to stop collecting data you can switch it to mode NONE.
Filed under: Azure, Azure SQL DB, QueryStore, SQL SERVER, SQL Server 2017 Tagged: Azure, Azure SQL DB, QueryStore, SQL Server 2016, SQL Server 2017, Technology