Microsoft SQL Server Enable query store on database


Example

Query store can be enabled on database by using the following command:

ALTER DATABASE tpch SET QUERY_STORE = ON

SQL Server/Azure SQL Database will collect information about executed queries and provide information in sys.query_store views:

  • sys.query_store_query
  • sys.query_store_query_text
  • sys.query_store_plan
  • sys.query_store_runtime_stats
  • sys.query_store_runtime_stats_interval
  • sys.database_query_store_options
  • sys.query_context_settings