While setting up example code for my presentation at SQL Cruise (which is going to be a fantastic event), I realized I wanted to purge all the data from my Query Store, just for testing. I did a series of searches to try to track down the information and it just wasn’t there. So, I did what anyone who can phrase a question in less than 140 characters should do, I posted a question to Twitter using the #sqlhelp hash tag.
Jamey Johnston (t|b) came through… and it was right there in the documentation that I had been reading, over and over. In fact, it was in the documentation in two different places. Reading is clearly a problem for me today.
Just so that you know, it’s actually really easy:
ALTER DATABASE AdventureWorks2014 SET QUERY_STORE CLEAR;
By the way, Query Store is absolutely amazing. Did you know that you can set up an extended event to fire when Query Store detects a query regression? Yep. The extended event query_store_aprc_regression will do just that. Query Store is coming with SQL Server 2016, but it’s already in production in Azure SQL Database.
Oh yes, we’re moving into some very interesting times for query tuning. Now if I can just get my reading comprehension to keep up…
The post Removing All SQL Server Query Store Data appeared first on Home Of The Scary DBA.