Редагувати

Поділитися через


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.

Transact-SQL syntax conventions

Syntax

sp_query_store_flush_db
[ ; ]

Return code values

0 (success) or 1 (failure).

Remarks

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.

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;