| title | sp_query_store_clear_message_queues (Transact-SQL) | ||
|---|---|---|---|
| description | Clears all queued (non-persisted) Query Store messages pending for the replica against which the command is executed. | ||
| author | markingmyname | ||
| ms.author | maghan | ||
| ms.reviewer | randolphwest | ||
| ms.date | 11/17/2025 | ||
| ms.service | sql | ||
| ms.subservice | system-objects | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
||
| monikerRange | >=sql-server-ver16 || >=sql-server-linux-ver16 || =azuresqldb-current |
[!INCLUDE sqlserver2025-asdb]
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 [!INCLUDE sssql25-md] and later versions, and in Azure SQL Database. For complete platform support, see Query Store for secondary replicas.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_query_store_clear_message_queues
[ ; ]
None.
0 (success) or 1 (failure).
Requires the ALTER permission on the database.
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;