Skip to content

Latest commit

 

History

History
64 lines (47 loc) · 2.55 KB

File metadata and controls

64 lines (47 loc) · 2.55 KB
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
sp_query_store_clear_message_queues_TSQL
sp_query_store_clear_message_queues
helpviewer_keywords
sp_query_store_clear_message_queues
sys.sp_query_store_clear_message_queues
dev_langs
TSQL
monikerRange >=sql-server-ver16 || >=sql-server-linux-ver16 || =azuresqldb-current

sp_query_store_clear_message_queues (Transact-SQL)

[!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

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;

Related content