Technology

REPEATABLEREAD Isolation Level in SQL Server

Premanath Kumarage · Author
2 min read
A business analytics graphic of charts and data icons over a desk

When you have issues around the table blockings etc, one of the solutions may be to change the database transaction isolation level from ‘SERIALIZABLE transaction isolation level” to “REPEATABLE READ transaction isolation level” This will improve general performance in situations where multiple…

When you have issues around the table blockings etc, one of the solutions may be to change the database transaction isolation level from ‘SERIALIZABLE transaction isolation level” to “REPEATABLE READ transaction isolation level” This will improve general performance in situations where multiple users are experiencing blocking when they are entering journal entries, sales order entries, purchase order entries and similar tasks.

The following example would give you an idea about the different impacts

Statement 1:

CUSTOMER.LOCKTABLE;

CUSTOMER.SETCURRENTKEY("Document No.", "Line No.");

CUSTOMER.SETRANGE(CUSTOMER."Document No.", '1');

CUSTOMER.SETRANGE(CUSTOMER."Line No.", 1, 10);

IF CUSTOMER.FIND('-') THEN

REPEAT

UNTIL (CUSTOMER.NEXT()=0);

Statement 2:

IF CUSTOMER.FIND('-') THEN

REPEAT

UNTIL (CUSTOMER.NEXT()=0);

With SERIALIZABLE transaction isolation level, all existing records will be locked during the first "REPEAT UNTIL" loop and other users will also be blocked from inserting new records within the specified range. The record that has Document No=2, Line No=1 will also be blocked. This will be main draw back in ‘SERIALIZABLE transaction isolation level”. In other words, the second loop will always read exactly the same result as the first loop.

With REPEATABLE READ transaction isolation level, however there is a potential where someone can theoretically insert a new record within the mentioned range which will then appear as an additional record in the second loop.

You can configure Ms Dynamics NAV to use the REPEATABLEREAD isolation level in SQL Server, by running the following TSQL statement against the SQL database; this will disable the 4194304 flag

update [$ndo$dbproperty] set diagnostics = diagnostics | 4194304

Source : http://blogs.msdn.com/b/nav/archive/2011/05/12/microsoft-dynamics-nav-changes-by-version.aspx

Written by

Premanath Kumarage

Author

All insights →

Start here

Every piece here started as a client problem. Tell us yours.

A working session, not a sales call. Bring the process your current system fights you on, and we will tell you plainly what it would take to fix it.

Newsletter

One email a month. No filler.

Stay ahead with Microsoft Business Applications.
Insights, implementation advice and practical ideas to help your business get more from Microsoft technology.

By subscribing, you acknowledge MicroCloud 360’s Privacy Policy.