Skip to content

Latest commit

 

History

History
49 lines (40 loc) · 2.81 KB

sys-query-store-replicas.md

File metadata and controls

49 lines (40 loc) · 2.81 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs monikerRange
sys.query_store_replicas (Transact-SQL)
The sys.query_store_replicas system view contains information about Query Store replicas.
MikeRayMSFT
mikeray
10/11/2022
sql
system-objects
reference
SYS.QUERY_STORE_REPLICAS_TSQL
QUERY_STORE_REPLICAS_TSQL
SYS.QUERY_STORE_REPLICAS
QUERY_STORE_REPLICAS
query_store_replicas catalog view
sys.query_store_replicas catalog view
TSQL
>=sql-server-ver16||>=sql-server-linux-ver16||=azuresqldb-mi-current

sys.query_store_replicas (Transact-SQL)

[!INCLUDE sqlserver2022-asmi]

Contains information about Query Store replicas, when Query Store for secondary replicas is enabled. You can use this information to determine what replica_group_id to use when using Query Store to force or un-force a plan on a secondary replica with sys.sp_query_store_set_query_hints.

Column name Data type Description
replica_group_id bigint Identifies the replica set number for this replica.
role_id tinyint 1 = Primary
2= Secondary
3=Geo-Primary
4=Geo-Secondary
replica_name nvarchar(max) Instance name of the replica in the availability group. NULL for replicas in [!INCLUDEssazuremi-md] or [!INCLUDE ssazure-sqldb].

Remarks

This catalog view will return the same row data on all replicas. The catalog view will contain a row per replica for every role_id where it has been observed. For example, a two-replica availability group will initially contain two rows. After a failover, it will contain four rows: one row for each replica in both the primary and secondary roles.

Permissions

Requires the VIEW DATABASE STATE permission.

Next steps