You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/relational-databases/performance/intelligent-query-processing-cardinality-estimation-feedback.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -134,7 +134,7 @@ If a query has a query plan forced through Query Store, CE feedback isn't used f
134
134
135
135
If a query uses hard-coded query hints or is using Query Store hints set by the user, CE feedback isn't used for that query. For more information, see [Query hints](../../t-sql/queries/hints-transact-sql-query.md) and [Query Store hint](query-store-hints.md).
136
136
137
-
Starting with [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)], when Query Store for secondary replicas is enabled, CE feedback isn't replica-aware for secondary replicas in availability groups. CE feedback currently only benefits primary replicas. On failover, feedback applied to primary or secondary replicas is lost. For more information, see [Query Store for secondary replicas](query-store-for-secondary-replicas.md).
137
+
Starting with [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)], when Query Store for secondary replicas is enabled, CE feedback isn't replica-aware for secondary replicas in availability groups. CE feedback currently only benefits primary replicas. On failover, feedback applied to primary or secondary replicas is lost. The Query Store is available on secondary availability group replicas starting in [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)]. For more information, see [Query Store for secondary replicas](query-store-for-secondary-replicas.md).
138
138
139
139
## Persistence for cardinality estimation (CE) feedback
Copy file name to clipboardExpand all lines: docs/relational-databases/performance/intelligent-query-processing-degree-parallelism-feedback.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,7 @@ Only verified feedback is persisted. If the adjusted DOP results in a performanc
63
63
64
64
Stable feedback is reverified upon plan recompilation and might readjust up or down, but never higher than the MAXDOP setting (including a MAXDOP hint).
65
65
66
-
Starting with [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)], when Query Store for secondary replicas is enabled, DOP feedback is also replica-aware for secondary replicas in availability groups. DOP feedback can apply feedback differently on a primary replica and on a secondary replica. However, DOP feedback is not persisted on secondary replicas, and on failover, the DOP feedback from the old primary replica is not applied to the new primary replica. On failover, feedback applied to primary or secondary replicas is lost. For more information, see [Query Store for secondary replicas](query-store-for-secondary-replicas.md).
66
+
Starting with [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)], when Query Store for secondary replicas is enabled, DOP feedback is also replica-aware for secondary replicas in availability groups. DOP feedback can apply feedback differently on a primary replica and on a secondary replica. However, DOP feedback is not persisted on secondary replicas, and on failover, the DOP feedback from the old primary replica is not applied to the new primary replica. On failover, feedback applied to primary or secondary replicas is lost. The Query Store is available on secondary availability group replicas starting in [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)]. For more information, see [Query Store for secondary replicas](query-store-for-secondary-replicas.md).
67
67
68
68
### Degree of parallelism (DOP) feedback implementation
Copy file name to clipboardExpand all lines: docs/relational-databases/performance/intelligent-query-processing-memory-grant-feedback.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -260,7 +260,7 @@ Given feedback data is now persisted in the Query Store, there's some increase i
260
260
261
261
Percentile-based memory grant errs on the side of reducing spills. Because it's no longer based on the last execution-only but on an observation of the several past executions, this could increase memory usage for oscillating workloads with wide variance in memory grant requirements between executions.
262
262
263
-
Starting with [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)], when Query Store for secondary replicas is enabled, memory grant feedback is replica-aware for secondary replicas in availability groups. Memory grant feedback can apply feedback differently on a primary replica and on a secondary replica. However, memory grant feedback is not persisted on secondary replicas, and on failover, the memory grant feedback from the old primary replica is applied to the new primary replica. Any feedback applied to the secondary replica when it becomes the primary replica is lost. For more information, see [Query Store for secondary replicas](query-store-for-secondary-replicas.md).
263
+
Starting with [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)], when Query Store for secondary replicas is enabled, memory grant feedback is replica-aware for secondary replicas in availability groups. Memory grant feedback can apply feedback differently on a primary replica and on a secondary replica. However, memory grant feedback is not persisted on secondary replicas, and on failover, the memory grant feedback from the old primary replica is applied to the new primary replica. Any feedback applied to the secondary replica when it becomes the primary replica is lost. The Query Store is available on secondary availability group replicas starting in [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)]. For more information, see [Query Store for secondary replicas](query-store-for-secondary-replicas.md).
The Query Store for secondary replicas feature enables the same Query Store functionality on secondary replica workloads that is available for primary replicas. When Query Store for secondary replicas is enabled, replicas send the query execution information that would normally be stored in the Query Store back to the primary replica. The primary replica then persists the data to disk within its own Query Store. In essence, there's one Query Store shared between the primary and all secondary replicas. The Query Store exists on the primary replica and stores data for all replicas together.
137
137
138
-
For complete information on Query Store for secondary replicas, see [Query Store for readable secondaries](query-store-for-secondary-replicas.md).
138
+
For more information, see [Query Store for secondary replicas](query-store-for-secondary-replicas.md).
Copy file name to clipboardExpand all lines: docs/relational-databases/performance/persisted-stats-secondary-replicas.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,15 +10,16 @@ ms.topic: concept-article
10
10
ms.custom:
11
11
- ignite-2025
12
12
# customer intent: As a data engineer, I want statistics that are created on readable secondaries to be persisted so that my workloads that are running against secondary replicas are optimized.
[Query Store for readable secondaries](query-store-for-secondary-replicas.md)was introduced in [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)], and the persisted statistics for readable secondaries feature uses the infrastructure that Query Store has in place for readable secondaries. Query Store for readable secondaries is **on** by default in [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)], whereas in [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)] it was **off** and required trace flag 12606 to enable.
20
+
[Query Store for readable secondaries](query-store-for-secondary-replicas.md)is available in [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)] and Azure SQL Database, and the persisted statistics for readable secondaries feature uses the infrastructure that Query Store has in place for readable secondaries.
20
21
21
-
Trace flag 12606 **isn't**required on [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)] and later versions and if used, result in turning the Query Store for readable secondaries feature *off*.
22
+
Query Store for readable secondaries is **on**by default in [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)] and Azure SQL Database.
22
23
23
24
## Background
24
25
@@ -27,6 +28,7 @@ On readable secondary replicas, statistics can also be automatically created whe
27
28
When the Database Engine creates temporary statistics, the statistics name is appended with the suffix `_readonly_database_statistic` to differentiate the temporary statistics from the permanent statistics. The suffix `_readonly_database_statistic` is reserved for statistics generated by SQL Server. The reason that this approach was taken was to address workloads that execute against readable secondary replicas that might require distinct statistics that don't exist on the primary replica.
28
29
29
30
Temporary statistics created on secondary replicas remain visible only to the replica that generated them. The primary replica never directly accesses these temporary statistics objects and is only aware of the permanent statistics object after persistence. When temporary statistics are persisted to the primary replica, they become available to all replicas in the availability group through the synchronization mechanism.
31
+
30
32
The persistence mechanism uses the Query Store for readable secondaries infrastructure introduced in [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)]. Statistics information is sent to the primary replica where it's persisted as permanent statistics, then synchronized back to all secondary replicas. This process occurs automatically without requiring manual intervention.
31
33
32
34
## Support catalog views
@@ -97,8 +99,6 @@ ORDER BY sch.[name], obj.[name], s.stats_id;
97
99
## Considerations
98
100
99
101
The persisted statistics for readable secondaries feature is enabled by default as long as the [auto create statistics](../../t-sql/statements/alter-database-transact-sql-set-options.md) option is enabled and the `READABLE_SECONDARY_TEMPORARY_STATS_AUTO_CREATE` and `READABLE_SECONDARY_TEMPORARY_STATS_AUTO_UPDATE` database scoped configuration options are enabled, which is the default configuration. There's no database-scoped configuration to toggle the feature on and off.
100
-
<!-- however, to disable the persistence of statistics from secondary for SQL Server, trace flag 15608 might be enabled at startup, or used as a global trace flag.
0 commit comments