Skip to content

Commit 90e75e4

Browse files
Add optimized locking on SQL MI AUTD (#34837)
1 parent 1634070 commit 90e75e4

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

azure-sql/managed-instance/doc-changes-updates-release-notes-whats-new.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn about the new features and documentation improvements for Azu
55
author: MashaMSFT
66
ms.author: mathoma
77
ms.reviewer: wiassaf, mathoma
8-
ms.date: 07/28/2025
8+
ms.date: 07/29/2025
99
ms.service: azure-sql-managed-instance
1010
ms.subservice: service-overview
1111
ms.topic: whats-new
@@ -57,6 +57,7 @@ The following table lists features of Azure SQL Managed Instance that have been
5757

5858
| Feature | GA Month | Details |
5959
| ---| --- |--- |
60+
|[Optimized locking](/sql/relational-databases/performance/optimized-locking)| July 2025 | Azure SQL Managed Instance with the [Always-up-to-date](update-policy.md#always-up-to-date-update-policy) update policy now has optimized locking enabled for all user databases. |
6061
|[UNISTR (Transact-SQL)](/sql/t-sql/functions/unistr-transact-sql) | July 2025 | Azure SQL Managed Instance now supports the `UNISTR` T-SQL syntax for Unicode string literals.|
6162
|[\|\| (String concatenation)](/sql/t-sql/language-elements/string-concatenation-pipes-transact-sql?view=azuresqldb-current&preserve-view=true) and [\|\|= (Compound assignment)](/sql/t-sql/language-elements/compound-assignment-pipes-transact-sql?view=azuresqldb-current&preserve-view=true) syntax support | July 2025 |Azure SQL Managed Instance now supports [\|\| (String concatenation)](/sql/t-sql/language-elements/string-concatenation-pipes-transact-sql?view=azuresqldb-current&preserve-view=true) and [\|\|= (Compound assignment)](/sql/t-sql/language-elements/compound-assignment-pipes-transact-sql?view=azuresqldb-current&preserve-view=true) Transact-SQL syntax.|
6263
| [Degrees of parallelism (DOP) feedback](/sql/relational-databases/performance/intelligent-query-processing-degree-parallelism-feedback?view=azuresqldb-mi-current&preserve-view=true) | July 2025| DOP feedback improves query performance by identifying parallelism inefficiencies for repeating queries, based on elapsed time and waits. For more information, see the [Smarter Parallelism: Degree of parallelism feedback in SQL Server 2025](https://techcommunity.microsoft.com/blog/sqlserver/smarter-parallelism-degree-of-parallelism-feedback-in-sql-server-2025/4431318) blog. |

docs/relational-databases/performance/optimized-locking.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: "Learn about the optimized locking enhancement to the database engi
44
author: MikeRayMSFT
55
ms.author: mikeray
66
ms.reviewer: randolphwest, peskount, praspu, dfurman
7-
ms.date: 07/07/2025
7+
ms.date: 07/29/2025
88
ms.service: sql
99
ms.subservice: performance
1010
ms.topic: conceptual
@@ -20,9 +20,9 @@ monikerRange: "=azuresqldb-current || =fabric || >=sql-server-ver17 || >=sql-ser
2020

2121
# Optimized locking
2222

23-
[!INCLUDE [sqlserver2025-asdb-fabric.md](../../includes/applies-to-version/sqlserver2025-asdb-fabricsqldb.md)]
23+
[!INCLUDE [sqlserver2025-asdb-asmi-fabricsqldb.md](../../includes/applies-to-version/sqlserver2025-asdb-asmi-fabricsqldb.md)]
2424

25-
This article introduces optimized locking, a database engine capability that offers an improved transaction locking mechanism to reduce lock memory consumption and blocking for concurrent transactions.
25+
Optimized locking offers an improved transaction locking mechanism to reduce lock blocking and lock memory consumption for concurrent transactions.
2626

2727
## What is optimized locking?
2828

@@ -49,15 +49,11 @@ The following table summarizes the availability and enabled state of optimized l
4949
| --- | --- | --- |
5050
|[!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)] | Yes | Yes (always enabled) |
5151
|[!INCLUDE [fabric-sqldb](../../includes/fabric-sqldb.md)] | Yes | Yes (always enabled) |
52-
|[!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)]<sup>AUTD</sup>| No | N/A |
53-
|[!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)]<sup>2022</sup>| No | N/A |
52+
|[!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)]<sup>[AUTD](/azure/azure-sql/managed-instance/update-policy#always-up-to-date-update-policy)</sup>| Yes | Yes (always enabled) |
53+
|[!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)]<sup>[2022](/azure/azure-sql/managed-instance/update-policy#sql-server-2022-update-policy)</sup>| No | N/A |
5454
|[!INCLUDE [sssql25-md](../../includes/sssql25-md.md)] | Yes | No (can be enabled per database) |
5555
|[!INCLUDE [sssql22-md](../../includes/sssql22-md.md)] and older versions | No | N/A |
5656

57-
<sup>AUTD</sup> Applies to Azure SQL Managed Instance configured with the [Always-up-to-date update policy](/azure/azure-sql/managed-instance/update-policy#always-up-to-date-update-policy).
58-
59-
<sup>2022</sup> Applies to Azure SQL Managed Instance configured with the [SQL Server 2022 update policy](/azure/azure-sql/managed-instance/update-policy#sql-server-2022-update-policy).
60-
6157
### Enable and disable
6258

6359
To enable or disable optimized locking for a [!INCLUDE [SQL Server](../../includes/ssnoversion-md.md)] database, use the `ALTER DATABASE ... SET OPTIMIZED_LOCKING = ON | OFF` command. For more information, see [ALTER DATABASE SET options](../../t-sql/statements/alter-database-transact-sql-set-options.md?view=sql-server-ver17&preserve-view=true#optimized_locking--on--off-).
@@ -67,7 +63,7 @@ Optimized locking builds on other database features:
6763
- You must enable [accelerated database recovery (ADR)](/azure/azure-sql/accelerated-database-recovery) on a database before you can enable optimized locking. Conversely, to disable ADR, you must disable optimized locking first if it's enabled.
6864
- For the most benefit from optimized locking, [read committed snapshot isolation (RCSI)](../../t-sql/statements/alter-database-transact-sql-set-options.md?view=azuresqldb-current&preserve-view=true#read_committed_snapshot--on--off--1) should be enabled for the database. The [LAQ](#lock-after-qualification-laq) component of optimized locking is in effect only if RCSI is enabled.
6965

70-
In [!INCLUDE [asdb](../../includes/ssazure-sqldb.md)], ADR is always enabled and RCSI is enabled by default.
66+
In [!INCLUDE [asdb](../../includes/ssazure-sqldb.md)] and [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)], ADR is always enabled and RCSI is enabled by default.
7167

7268
To verify that these options are enabled for your current database, connect to the database and run the following T-SQL query:
7369

@@ -317,7 +313,7 @@ The following improvements help you monitor and troubleshoot blocking and deadlo
317313
- Under each resource in the deadlock report `<resource-list>`, each `<xactlock>` element reports the underlying resources and specific information for locks of each member of a deadlock. For more information and an example, see [Optimized locking and deadlocks](../sql-server-deadlocks-guide.md#optimized-locking-and-deadlocks).
318314
- Extended events
319315
- The `lock_after_qual_stmt_abort` event fires when a statement is internally aborted and restarted because of a conflict with another transaction. For more information, see [Lock after qualification (LAQ)](#lock-after-qualification-laq).
320-
- In [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)], the `locking_stats` event fires for every database every several minutes and provides aggregate locking statistics for the time interval, such as the number of lock escalations, whether TID locking and LAQ components of optimized locking are enabled, and the number of queries where LAQ wasn't used for various reasons. This event fires even if optimized locking is disabled.
316+
- In [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)] and [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)], the `locking_stats` event fires for every database every several minutes and provides aggregate locking statistics for the time interval, such as the number of lock escalations, whether TID locking and LAQ components of optimized locking are enabled, and the number of queries where LAQ wasn't used for various reasons. This event fires even if optimized locking is disabled.
321317

322318
## Best practices with optimized locking
323319

@@ -381,7 +377,7 @@ In the previous query example, only table `t5` uses the `REPEATABLE READ` isolat
381377

382378
### Is optimized locking on by default in both new and existing databases?
383379

384-
In [!INCLUDE [Azure SQL Database](../../includes/ssazure-sqldb.md)] and [!INCLUDE [fabric-sqldb](../../includes/fabric-sqldb.md)], yes. In [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)] optimized locking is disabled by default but can be enabled on any user database that has accelerated database recovery enabled.
380+
In [!INCLUDE [Azure SQL Database](../../includes/ssazure-sqldb.md)], [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)]<sup>[AUTD](/azure/azure-sql/managed-instance/update-policy#always-up-to-date-update-policy)</sup>, and [!INCLUDE [fabric-sqldb](../../includes/fabric-sqldb.md)], yes. In [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)] optimized locking is disabled by default but can be enabled on any user database that has accelerated database recovery enabled.
385381

386382
### How can I detect if optimized locking is enabled?
387383

0 commit comments

Comments
 (0)