sp_query_store_flush_db (Transact-SQL)
Applies to:
SQL Server 2016 (13.x) and later
Azure SQL Database
Azure 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.
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:
- Monitoring Performance By Using the Query Store
- sp_query_store_force_plan (Transact-SQL)
- sp_query_store_remove_query (Transact-SQL)
- sp_query_store_unforce_plan (Transact-SQL)
- sp_query_store_reset_exec_stats (Transact-SQL)
- sp_query_store_remove_plan (Transct-SQL)
- sp_query_store_reset_exec_stats (Transact-SQL)
- Query Store Catalog Views (Transact-SQL)