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
**Applies to:**[!INCLUDE [sql-server-2025](../../includes/sssql25-md.md)], [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)] and [!INCLUDE [fabric-sqldb](../../includes/fabric-sqldb.md)]
510
511
511
512
Enables or disables the compilation serialization behavior of `sp_executesql` when a batch is compiled. The default is `OFF`. Allowing batches which use `sp_executesql` to serialize the compilation process reduces the impact of compilation storms. A compilation storms refers to a situation where a large number of queries are being compiled simultaneously, leading to performance issues and resource contention.
512
513
@@ -521,6 +522,21 @@ Enables or disables [optimized Halloween protection](../../relational-databases/
521
522
> [!NOTE]
522
523
> For database compatibility level 160 or lower, this database scoped configuration has no effect.
523
524
525
+
#### OPTIONAL_PARAMETER_PLAN_OPTIMIZATION = { ON | OFF }
Enables or disables the [Optional parameter plan optimization](../../relational-databases/performance/optional-parameter-optimization.md) feature. The default is `ON`.
530
+
531
+
When enabled, the adaptive plan optimization generates multiple execution plans for queries that include optional parameters. These plans are typically expressed using predicates in the form of:
532
+
533
+
-`@p IS NULL AND @p1 IS NOT NULL`
534
+
-`@p IS NULL OR @p1 IS NOT NULL`
535
+
536
+
The feature can choose a more optimal plan at runtime based on whether the parameter is `NULL`, which improves performance for queries that could otherwise default to suboptimal performance for such query patterns.
537
+
538
+
The default is `ON` starting in database compatibility level 170.
539
+
524
540
## Permissions
525
541
526
542
Requires `ALTER ANY DATABASE SCOPED CONFIGURATION` on the database. This permission can be granted by a user with `CONTROL` permission on a database.
0 commit comments