Rediger

Del via


sp_query_store_clear_message_queues (Transact-SQL)

Applies to: SQL Server 2025 (17.x) Azure SQL Database

Clears all queued (non-persisted) Query Store messages pending for the replica against which the command is executed. sp_query_store_clear_message_queues is used when Query Store for readable secondaries has been enabled.

Query Store for secondary replicas is supported starting in SQL Server 2025 (17.x) and later versions, and in Azure SQL Database. For complete platform support, see Query Store for secondary replicas.

Transact-SQL syntax conventions

Syntax

sp_query_store_clear_message_queues
[ ; ]

Arguments

None.

Return code values

0 (success) or 1 (failure).

Permissions

Requires the ALTER permission on the database.

Examples

The following example clears all queued (non-persisted) Query Store messages pending. The action applies to the replica against which the command is executed.

EXECUTE sp_query_store_clear_message_queues;