Questions tagged [snapshot-isolation]
53 questions
14
votes
2 answers
Snapshot isolation transaction aborted due to update conflict
Following statement:
INSERT INTO dbo.Changes([Content], [Date], [UserId], [CompanyId])
VALUES (@1, @2, @3, @4);
SELECT @@identity;
gives me this SQL error 3960:
Snapshot isolation transaction aborted due to update conflict. You
cannot use…

TN.
- 18,874
- 30
- 99
- 157
7
votes
1 answer
Why does inserting a row with a foreign key referencing a row by pk modified in another snapshot isolation transaction cause the transaction to hang?
I ran into an interesting problem in a system where due to a schema change, a first database transaction in a single thread blocks a second database transaction from completing, until a timeout occurs.
To test this I created a test database:
CREATE…

Sam Rueby
- 5,914
- 6
- 36
- 52
7
votes
1 answer
Verify if SNAPSHOT isolation level is on in SQL Server 2008 R2
What SQL will I execute in SSMS for SQL Server 2008 R2 to know if SNAPSHOT isolation level is turned on in the database?

Sunil
- 20,653
- 28
- 112
- 197
6
votes
2 answers
SQL Server in-memory oltp transaction snapshot isolation
Trying to understand how transaction isolation levels work on SQL Server memory optimized tables (in-memory oltp).
If I execute the following query:
SET TRANSACTION ISOLATION LEVEL READ COMMITTED
BEGIN TRANSACTION
SELECT *
FROM tm.Tasks
An error…

gio
- 337
- 3
- 8
6
votes
2 answers
Unable to restore database to a snapshot in SQL Server
I want to create a database snapshot and restore database to it every time a unit test is run. I am able to create snapshot but while restoring it, I encounter the error below while doing it.
Msg 5070, Level 16, State 2, Line 1
Database state…

Madhur Maurya
- 1,016
- 4
- 19
- 42
6
votes
2 answers
Oracle equivalent of SQL Server Snapshot isolation
In Microsoft SQL Server, I use the READ_COMMITTED_SNAPSHOT ISOLATION
ALTER DATABASE MyDatabase
SET ALLOW_SNAPSHOT_ISOLATION ON
ALTER DATABASE MyDatabase
SET READ_COMMITTED_SNAPSHOT ON
In Session 1,update the Principal from 4000 to 5000
BEGIN…

VenVig
- 645
- 1
- 10
- 14
5
votes
3 answers
How to set InnoDB in MySQL to the snapshot isolation level
I'm working on a school project now that needs to characterize the performance of MySQL with regards to different isolation levels. I've tested things on READ UNCOMMITTED, READ COMMITTED, REPEATABLE READ and SERIALIZABLE. Now I'd like to test things…

user1251858
- 303
- 2
- 4
- 13
5
votes
1 answer
How to implement Snapshot Isolation correctly and tempdb issues?
The Snapshot Isolation feature helps us to solve the problem where readers lock out writers on high volume sites. It does so by versioning rows using tempdb in SqlServer.
My question is to correctly implement this Snapshot Isolation feature, is it…

Ray
- 12,101
- 27
- 95
- 137
4
votes
2 answers
Snapshot isolation behaviour. "Triggered" at first query?
I am doing some tests to try to understand how snapshot isolation works...and I do not. I have SET ALLOW_SNAPSHOT_ISOLATION ON in my db (not interested in READ_COMMITTED_SNAPSHOT atm). Then I do the following tests. I will mark different sessions…

George Menoutis
- 6,894
- 3
- 19
- 43
4
votes
0 answers
Switch isolation level from SNAPSHOT on active transaction and run DDL
I would like to force MS SQL Server to use SNAPSHOT isolation level, but in the same transaction, I have to run DML and DDL operation. As I know we can't run DDL (most of DDL operation) in a transaction with SNAPSHOT isolation level.
In article…

Adrian
- 406
- 4
- 9
4
votes
1 answer
Snapshot transaction Isolation levels: it really works as advertised?
Have you any problems using it on high concurrency environment? It's really works as advertised by MS? I'm using SQL Server 2005 and would like to hear the experiences of those who are/was using it on applications using it on production.
Snapshot…

Fabricio Araujo
- 3,810
- 3
- 28
- 43
3
votes
1 answer
optimistic lock with a "version" field vs snapshot isolation level
I was wondering what are the advantage/inconvenient for these two optimistic lock solutions :
Use a "version" field and detect changes during updates (i.e. using
hibernate @Version annotation)
Use the Snapshot isolation level on transactions
If…

Quentin
- 3,150
- 4
- 24
- 34
3
votes
1 answer
Change isolation level in individual ADO.NET transactions only
What is the best way to implement different isolation levels for individual transactions when using a client framework, ORM or similar to build queries, which does not support query hints like WITH(NOLOCK)?
Imagine an application which uses…

Erik Hart
- 1,114
- 1
- 13
- 28
2
votes
1 answer
Under Snapshot isolation in SQL Server, "update conflict" errors do not produce pretty graphs like Deadlocks do. Is there an analogous tool for these?
When using the Snapshot transaction isolation level, deadlocks are exceedingly rare, but snapshot update conflict errors are common (in a busy OLTP system). These errors are often expected under certain workloads, but if you have something in your…

ahalbert
- 21
- 1
2
votes
3 answers
Prevent lost updates with high transaction isolation levels: Is this a common misconception?
I noticed that my applications often write values to a database that depend on a former read operation. A common example is a bank account where a user could deposit money:
void deposit(amount) {
balance = getAccountBalance()
…

fishbone
- 3,140
- 2
- 37
- 50