Query Store Purge Query Data

Alen Cappelletti 931 Reputation points
2022-04-26T12:47:56.71+00:00

Hi all,
I activate query store on one DB for some days... (I'm on SQL SERVER 2017), and a now I would like to purge all data.

Naturally I stopped (turn off) query store... but either by pressing the button from the graphic interface, or by executing the query

ALTER DATABASE XXXX SET QUERY_STORE CLEAR;

I see always 4 MB of query store space used. Is it normal this situation?

ALEN

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,814 questions
{count} votes

Accepted answer
  1. CathyJi-MSFT 21,096 Reputation points Microsoft Vendor
    2022-04-27T02:57:25.24+00:00

    Hi @Alen Cappelletti ,

    Did you refresh the SQL server DB after you purged query store and turned off the query store? Then check the Query Store usage from SSMS UI or through the T-SQL that offered by Ben.

    In addition, please read the below blog to better understood the information about clearing the Query Store.

    Manually Clearing the Query Store


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".


1 additional answer

Sort by: Most helpful
  1. Jingyang Li 5,891 Reputation points
    2022-04-26T13:33:30.917+00:00

    What about this?
    ALTER DATABASE XXXX SET QUERY_STORE CLEAR ALL;