Hi **Nancy Wotawa,
**Please be informed that if the query runs on secondary then it will show as secondary only.
Queries for the read‑only replica are now visible in the primary database’s Query Store.
Please verify the application’s connection string and check whether it is using read‑only or read‑write intent. If the connection string specifies ApplicationIntent=ReadOnly, the query will automatically route to the secondary replica.
Read-only workload executed on secondary replicas may appear under the primary’s Query Store and Query Performance Insight on Azure Portal, even though execution still occurs on the replica. This behavior is by design and enabled to provide better end-to-end performance visibility. The document also outlines quick methods via T‑SQL and SSMS Query Store reports to verify whether a query actually ran on the primary or secondary replica.
To identify where a query actually ran (Primary vs. Replica), you can check the new column in **sys.query_store_runtime_stats.
**https://learn.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-query-store-runtime-stats-transact-sql?view=sql-server-ver17
Run this query either on primary database or read replica
SELECT TOP 200
qsq.query_id,
qsp.plan_id,
CASE qrs.replica_group_id
WHEN 1 THEN 'PRIMARY'
WHEN 2 THEN 'SECONDARY'
WHEN 3 THEN 'GEO SECONDARY'
WHEN 4 THEN 'GEO HA SECONDARY'
ELSE CAST(qrs.replica_group_id AS NVARCHAR(200))
END AS replica_type,
qsq.query_hash,
qsp.query_plan_hash,
SUM(qrs.count_executions) AS sum_executions,
SUM(qrs.count_executions * qrs.avg_logical_io_reads) AS total_logical_reads,
SUM(qrs.count_executions * qrs.avg_cpu_time / 1000.0) AS total_cpu_ms,
AVG(qrs.avg_logical_io_reads) AS [avg_logical_io_reads],
AVG(qrs.avg_cpu_time / 1000.0) AS [avg_cpu_ms],
ROUND(
TRY_CAST(SUM(qrs.avg_duration * qrs.count_executions) AS FLOAT) /
NULLIF(SUM(qrs.count_executions), 0) * 0.001, 2) AS avg_duration_ms,
COUNT(DISTINCT qsp.plan_id) AS number_of_distinct_plans,
qsqt.query_sql_text,
TRY_CONVERT(XML, qsp.query_plan) AS [query_plan]
FROM sys.query_store_runtime_stats_interval qsrsi
INNER JOIN sys.query_store_runtime_stats qrs
ON qrs.runtime_stats_interval_id = qsrsi.runtime_stats_interval_id
INNER JOIN sys.query_store_plan qsp
ON qsp.plan_id = qrs.plan_id
INNER JOIN sys.query_store_query qsq
ON qsq.query_id = qsp.query_id
INNER JOIN sys.query_store_query_text qsqt
ON qsq.query_text_id = qsqt.query_text_id
WHERE qsrsi.start_time >= DATEADD(HOUR, -8, GETUTCDATE())
GROUP BY
qsq.query_id,
qsq.query_hash,
qsp.query_plan_hash,
qsp.plan_id,
qrs.replica_group_id,
qsqt.query_sql_text,
qsp.query_plan
ORDER BY
SUM(qrs.count_executions * qrs.avg_logical_io_reads) DESC;

Query Store — Replica filter dropdown. **(Replica option visible in SSMS 2021 onwards).
- Open SSMS and connect to the database.
- Expand Database → Query Store.
- Open “Top Resource Consuming Queries” (or “Queries with High Variation”).
- Use the Replica dropdown to choose Primary, Secondary, GeoSecondary, or GeoHASecondary.
- Confirm recent intervals show the query under SECONDARY.

https://learn.microsoft.com/en-us/sql/relational-databases/performance/query-store-for-secondary-replicas?view=sql-server-ver17