title | description | author | ms.author | ms.reviewer | ms.date | ms.service | ms.subservice | ms.topic | f1_keywords | helpviewer_keywords | dev_langs | monikerRange | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sp_query_store_flush_db (Transact-SQL) |
Flushes the in-memory portion of the Query Store data to disk. |
markingmyname |
maghan |
randolphwest |
08/21/2024 |
sql |
system-objects |
reference |
|
|
|
=azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current |
[!INCLUDE sqlserver2016-asdb-asdbmi]
Flushes the in-memory portion of the Query Store data to disk.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_query_store_flush_db
[ ; ]
0
(success) or 1
(failure).
If Query Store for secondary replicas 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.
Requires the ALTER permission on the database.
The following example flushes the in-memory portion of the Query Store data to disk.
EXEC sp_query_store_flush_db;
- Monitor performance by using the Query Store
- Query Store for secondary replicas
- 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)