Merk
Tilgang til denne siden krever autorisasjon. Du kan prøve å logge på eller endre kataloger.
Tilgang til denne siden krever autorisasjon. Du kan prøve å endre kataloger.
Applies to:
SQL Server 2016 (13.x) and later versions
Azure SQL Database
Azure SQL Managed Instance
SQL database in Microsoft Fabric
Flushes the in-memory portion of the Query Store data to disk.
Transact-SQL syntax conventions
Syntax
sp_query_store_flush_db
[ ; ]
Arguments
None.
Return code values
0 (success) or 1 (failure).
Remarks
If Query Store for readable secondaries is enabled, when sys.sp_query_store_flush_db is executed on a secondary replica, that secondary replica's cache is forced to flush to the cache on the primary replica. This can accelerate the Query Store cache data being synced to the primary replica, if the secondary replica cache flush is otherwise delayed under heavy workload.
Permissions
Requires the ALTER permission on the database.
Examples
The following example flushes the in-memory portion of the Query Store data to disk.
EXECUTE sp_query_store_flush_db;
Related content
- Monitor performance by using the Query Store
- Query Store for readable secondaries
- 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 (Transact-SQL)
- Query Store catalog views (Transact-SQL)