Skip to content

Commit 1920aa9

Browse files
authored
Update optimized-plan-forcing-query-store.md
1 parent 3133e55 commit 1920aa9

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

docs/relational-databases/performance/optimized-plan-forcing-query-store.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ Find an example of applying this query hint in [Example E](#e-disable-optimized-
6363

6464
### Force a plan with Query Store, but disable optimized plan forcing
6565

66-
The [sp_query_store_force_plan](../system-stored-procedures/sp-query-store-force-plan-transact-sql.md) procedure includes a `disable_optimized_plan_forcing` parameter, with default OFF (0) (if the parameter is omitted from the procedure call).
66+
The [sp_query_store_force_plan](../system-stored-procedures/sp-query-store-force-plan-transact-sql.md) procedure includes a `disable_optimized_plan_forcing` parameter. In order to use this parameter, an additional parameter is required by the sp_query_store_force_plan stored procedure. The additional parameter is called `replica_group_id`. By default, the primary `replica_group_id` will have a value of one (*1*) even in the case where there are no configured secondary replicas.
67+
68+
Find an example of applying this query hint in [Example C](#c-force-a-plan-and-disable-optimized-plan-forcing-in-query-store).
6769

6870
The `sys.query_store_plan` catalog view includes columns that indicate if the plan has an associated optimization replay script, and adds a new state to existing failure reason column specific to associated optimization replay script. Learn more in [sys.query_store_plan (Transact-SQL)](../system-catalog-views/sys-query-store-plan-transact-sql.md).
6971

@@ -111,10 +113,10 @@ GO
111113

112114
### C. Force a plan and disable optimized plan forcing in Query Store
113115

114-
The following code forces a plan in Query Store, but disables optimized plan forcing. Before running the following code, replace `@query_id` and `@plan_id` with a combination appropriate for your instance. The sp_query_store_force_plan stored procedure will also accept an optional third `@replica_group_id` parameter. This can be used to force a plan on a specific replica. A value of 0 - `@replica_group_id=0` will be used if this parameter is omitted.
116+
The following code forces a plan in Query Store, but disables optimized plan forcing. Before running the following code, replace `@query_id` and `@plan_id` with a combination appropriate for your instance. The sp_query_store_force_plan stored procedure will expect that the `@replica_group_id` parameter be passed in as the third parameter value when attempting to disabled optimized plan forcing in Query Store. This can be used to disable optimized plan forcing for a particular forced plan on a specific replica. A value of 1 - `@replica_group_id=1` will be used to disable the feature on the primary replica.
115117

116118
```sql
117-
EXEC sp_query_store_force_plan @query_id=148, @plan_id=4, @disable_optimized_plan_forcing=0;
119+
EXEC sp_query_store_force_plan @query_id=148, @plan_id=4, @replica_group_id=1, @disable_optimized_plan_forcing=1;
118120
GO
119121
```
120122

0 commit comments

Comments
 (0)