Configuring the Query Store

Azure SQL Database has the Query Store enabled by default. However, on SQL Server, it must be enabled manually. This can be done in two different ways:

  • Using T-SQL, as seen in the following example for the AdventureWorks2016 sample database:
USE [master]GOALTER DATABASE [AdventureWorks2016]SET QUERY_STORE = ONGOALTER DATABASE [AdventureWorks2016]SET QUERY_STORE (OPERATION_MODE = READ_WRITE)GO
  • Using SSMS, when we right-click on a database name in Object Explorer, select Properties, select the Query Store page, and change Operation Mode from Off to Read Write, as shown in the following screenshot:

In the previous ...

Get Learn T-SQL Querying now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.