Non-Repeatable Read vs Phantom Read?

From Wikipedia (which has great and detailed examples for this): A non-repeatable read occurs, when during the course of a transaction, a row is retrieved twice and the values within the row differ between reads. and A phantom read occurs when, in the course of a transaction, two identical queries are executed, and the collection … Read more

Spring Batch ORA-08177: can’t serialize access for this transaction when running single job, SERIALIZED isolation level

From official doc – 4.3.1 The default isolation level for that method is SERIALIZABLE, which is quite aggressive: READ_COMMITTED would work just as well; READ_UNCOMMITTED would be fine if two processes are not likely to collide in this way. However, since a call to the create* method is quite short, it is unlikely that the … Read more

BeginTransaction with IsolationLevel in EF Core

The EF Core code is exactly the same. DbContext.Database.BeginTransaction(IsolationLevel.Snapshot); The only difference is that in EF Core the method with isolation level (as many others) is an extension method, defined in RelationalDatabaseFacadeExtensions class, and importantly, located in Microsoft.EntityFrameworkCore.Relational assembly. So if you have using Microsoft.EntityFrameworkCore; and don’t see it, add reference to the Microsoft.EntityFrameworkCore.Relational.dll assembly … Read more

Transaction Isolation Level Scopes

Run the following and see for yourself: CREATE PROCEDURE dbo.KeepsIsolation AS BEGIN PRINT ‘Inside sproc that does not change isolation level’; DBCC USEROPTIONS; END GO CREATE PROCEDURE dbo.ChangesIsolation AS BEGIN PRINT ‘Inside sproc that changes isolation level’; SET TRANSACTION ISOLATION LEVEL READ COMMITTED; DBCC USEROPTIONS; END GO SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; DBCC USEROPTIONS; … Read more

Difference between “read commited” and “repeatable read” in SQL Server

Read committed is an isolation level that guarantees that any data read was committed at the moment is read. It simply restricts the reader from seeing any intermediate, uncommitted, ‘dirty’ read. It makes no promise whatsoever that if the transaction re-issues the read, will find the Same data, data is free to change after it … Read more

What is (are) difference between NOLOCK and UNCOMMITTED

NOLOCK : Is equivalent to READ UNCOMMITTED (source : MSDN) NOLOCK or READ UNCOMMITTED Specifies that dirty reads are allowed. No shared locks are issued to prevent other transactions from modifying data read by the current transaction, and exclusive locks set by other transactions do not block the current transaction from reading the locked data. … Read more

Read committed Snapshot VS Snapshot Isolation Level

READ COMMITTED SNAPSHOT does optimistic reads and pessimistic writes. In contrast, SNAPSHOT does optimistic reads and optimistic writes. Microsoft recommends READ COMMITTED SNAPSHOT for most apps that need row versioning. Read this excellent Microsoft article: Choosing Row Versioning-based Isolation Levels. It explains the benefits and costs of both isolation levels. And here’s a more thorough … Read more

Why is System.Transactions TransactionScope default Isolationlevel Serializable

The fact Serializable is the default comes from times when .NET wasn’t even released (before year 1999), from DTC (Distributed Transaction Coordinator) programming. DTC uses a native ISOLATIONLEVEL enumeration: ISOLATIONLEVEL_SERIALIZABLE Data read by a current transaction cannot be changed by another transaction until the current transaction finishes. No new data can be inserted that would … Read more