Problems caused by SQL Server 2016 Query Store I have been testing SQL Server 2016 (Standard) on an Azure VM and have encountered a problem.

In my SQL logs I am seeing SQLExceptions and eventid 1001 and this is happening every 15 minutes.


2016-06-30 15:20:45.83 spid43s     ***Stack Dump being sent to C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\LOG\SQLDump2693.txt
2016-06-30 15:20:45.83 spid43s     SqlDumpExceptionHandler: Process 43 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
2016-06-30 15:20:45.83 spid43s     * *******************************************************************************
2016-06-30 15:20:45.83 spid43s     *
2016-06-30 15:20:45.83 spid43s     * BEGIN STACK DUMP:
2016-06-30 15:20:45.83 spid43s     *   06/30/16 15:20:45 spid 43
2016-06-30 15:20:45.83 spid43s     *
2016-06-30 15:20:45.83 spid43s     *
2016-06-30 15:20:45.83 spid43s     *   Exception Address = 00007FF9796D4BB2 Module(sqlmin+0000000000064BB2)
2016-06-30 15:20:45.83 spid43s     *   Exception Code    = c0000005 EXCEPTION_ACCESS_VIOLATION
2016-06-30 15:20:45.83 spid43s     *   Access Violation occurred reading address 0000000000000948


I have enabled Query Store on my databases and it is set to a Data Flush Interval of 15 minutes.

With query store turned off these exceptions appear to stop. 

I am not experiencing this problem on my local install of SQL Server (Developer Edition).

Data is identical on Azure and local machine, both build 13.0.1601.5.
This was a known bug with Query Store on Standard and Express.


  Automatic data cleanup fails on editions other than Enterprise and Developer. Consequently, space used by the Query Store will grow over time until configured limit is reached, if data is not purged manually. If not mitigated, this issue will also fill up disk space allocated for the error logs, as every attempt to execute cleanup will produce a dump file. Cleanup activation period depends on the workload frequency, but it is no longer than 15 min.


The work around is to turn off cleanup policies and manually clear query store data. 

to clear all query store data

ALTER DATABASE &lt;database name&gt; SET QUERY_STORE CLEAR


to selectively clear data

sp_query_store_reset_exec_stats

sp_query_store_remove_plan

sp_query_store_remove_query


The issue was first fixed in Cumulative Update 1 for SQL Server 2016:

Query Store automatic data cleanup fails on editions other than Enterprise and Developer edition of SQL Server 2016 (KB 3178297)