sp_query_store_flush_db (Transact-SQL)

Applies to: yesSQL Server 2016 (13.x) and later YesAzure SQL Database YesAzure SQL Managed Instance

Flushes the in-memory portion of the Query Store data to disk. If Query Store for secondary replicas is enabled, this only impacts the primary replica.

Topic link icon Transact-SQL Syntax Conventions

Syntax

sp_query_store_flush_db [;]  

Return Code Values

0 (success) or 1 (failure)

Permissions

Requires the ALTER permission on the database.

Examples

The following example flushes the in-memory portion of the Query Store data to disk.

EXEC sp_query_store_flush_db;  

Next steps

Learn more about Query Store in the following articles: