Business Central 2026 release wave 2 (BC29): Control transaction isolation for queries and isolated storage (Query ReadState supports ReadCommitted)

Dynamics 365 Business Central

Hi, Readers.
The public preview for Dynamics 365 Business Central 2026 release wave 2 (BC29) is available. Learn more: Link.

I will continue to test and share some new features that I hope will be helpful. In this post, I would like to talk about Query ReadState supports ReadCommitted.
Query ReadState supports ReadCommitted:

Read only committed data in AL queries and choose the isolation level for isolated-storage reads, including row locking for safer read-modify-write operations.

https://marketplace.visualstudio.com/items/ms-dynamics-smb.al/changelog

In Business Central 2023 release wave 1 (BC22), a new ReadIsolation method was introduced for the Record data type. More details: Business Central 2023 wave 1 (BC22) new features: Control database locking behavior (new ReadIsolation method)

In this major update (BC29), Microsoft has also made similar functionality available for Queries. AL queries can now use ReadState = ReadCommitted to read only committed data without guaranteeing that rows remain consistent throughout the transaction.

ReadCommitted: Reads only data that has been committed to the database. Rows read are not guaranteed to remain consistent throughout the current transaction. If you are familiar with SQL, this mode translates to reading the data with Read Committed.

ReadExclusive: Reads only data that has been committed to the database. Update locks are placed on all read data, which prevents it from being modified or deleted by other transactions. It is possible for other transactions to read the data depending on their transaction types. Note: The Transaction Type of the transaction within which the query is running is not affected. If you are familiar with SQL, this mode translates to reading the data with UpdLocks.

ReadShared: Reads only data that has been committed to the database. Share locks are placed on all read data, which prevents it from being modified or deleted by other transactions. The locks are held until the current transaction is committed. It is possible for other transactions to read the data. Note: The Transaction Type of the transaction within which the query is running is not affected. If you are familiar with SQL, this mode translates to reading the data with Repeatable Read.

ReadUncommitted (Default): Reads all data, regardless of whether it has been committed to the database. This means that the query can read data from table rows that have been modified by another running transaction, but have not yet been committed. This mode is sometimes referred to as a dirty read. For those familiar with SQL, this translates to reading the data with ‘Read Uncommitted’. No additional locks are placed on the read data. Because the query does not lock the rows it reads, other transactions can also read, modify, and delete the same data as the query. Setting the property to ReadUncommitted can improve performance compared to ReadShared and ReadExclusive. However, the query can read data that potentially is rolled back or changed by another transaction when the query is running.

Great. Give it a try!!!😁

PS: Dynamics 365 Business Central: Database Locks

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL