Questions tagged [transaction-isolation]

Transaction isolation relates to the visibility and impact of changes made in one transaction on concurrent transactions.

256 questions
0
votes
2 answers

How to create transaction with isolation level in SQL

How to create a transaction with isolation level in SQL. I'v tried something like this, but obviously it does not work: INSERT INTO test(col1) VALUES ('test') SET TRANSACTION ISOLATION LEVEL read stability; COMMIT WORK; I'm using SQL DB2 LUW
ahm5
  • 633
  • 5
  • 9
0
votes
1 answer

update then select value which updated by other transaction but get the value before update

mysql: 8.0.23 transaction isolation level: repeatable read test data: create table test.test ( id int primary key, value int ); insert into test.test(id,value) values(1,0); In same transaction, we get output value is 1 as we have execute…
14sxlin
  • 76
  • 5
0
votes
1 answer

Is optimistic locking equivalent to Select For Update?

It is my first time using EF Core and DDD concepts. Our database is Microsoft SQL Server. We use optimistic concurrency based on the RowVersion for user requests. This handles concurrent read and writes by users. With the DDD paradigma user changes…
0
votes
2 answers

How to enforce a phantom read in PostgreSQL?

I'm currently writing an article about different transaction isolation levels and want to show the dirty read / non-repeatable read / phantom read. Dirty reads are impossible to show as PostgreSQL does not have READ_UNCOMMITTED, I do have an example…
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
0
votes
1 answer

Best suitable transaction isolation level when business rules are not strict

Short version: I am trying to determine which is the best transaction isolation level for the SQL server in our premises. Long version: I am extracting data from API calls and loading it into staging tables which then are incrementally loaded into…
0
votes
1 answer

Read-only transaction anomaly

I've learned about this anomaly from these papers: https://www.cs.umb.edu/~poneil/ROAnom.pdf (original) https://johann.schleier-smith.com/blog/2016/01/06/analyzing-a-read-only-transaction-anomaly-under-snapshot-isolation.html (short and easy…
Max
  • 21
  • 3
0
votes
2 answers

Atomic UPDATE with nested SELECT clause in Postgres

I have a cluster where one of the nodes is master. The synchronization/decision making who will become the new master is done throught the database(Postgres accessed via java/spring/jpa). Here's what I currently have @Repository public interface…
Ventsyslav Raikov
  • 6,882
  • 1
  • 25
  • 28
0
votes
1 answer

Isolated managed object context for FetchRequest in SwiftUI

In a SwiftUI view, by default FetchRequest fetches from the managedObjectContext environment value. If instead the view wants to fetch into an isolated context, for example to make discardable edits without polluting the context of other views, how…
Edward Brey
  • 40,302
  • 20
  • 199
  • 253
0
votes
1 answer

PostgreSQL transaction level guarantees for foreign key consistency in read only transactions

Application A (think exporter) needs to read all rows of all tables from a running PostgreSQL database. Meanwhile Application B (think web application) continues to do reads and writes. Table child has an optional foreign key to parent. I've had…
0
votes
0 answers

Why we need @Transaction Attribute in spring for only select statement - NO ddl in service layer

I read multiple threads but I didn't get the answer to why we need to use @Transaction attribute for the select query. Assume we don't have any other DDL statements just plain select statements which read data and displays on UI. Transaction…
0
votes
0 answers

Querying SQL Server tables while they are locked

I have two DBs on Azure let's say DBLive and DBCrud. DBLive contains the tables that provide the real data. There is one table for which the CRUD operations are not done on DBLive but on DBCrud. The table structure is replicated on DBCrud - so after…
0
votes
1 answer

how to do column-level locking? Is that possible?

Let's say I have a table as below: +----+------+--------+ | ID | NAME | STATUS | +----+------+--------+ | 1 | ADAM | ACTIVE | | 2 | EVE | ACTIVE | | 3 | JOHN | ACTIVE | +----+------+--------+ Let's say I want to do column-level locking - the…
janetsmith
  • 8,562
  • 11
  • 58
  • 76
0
votes
1 answer

Do Hibernate Isolation work on insertion?

I have a problem that could probably be addressed in various ways including re-challenging database design, but my manager has a bias for the Hibernate annotations and here we are. We want to insert family members in a table. Some of the columns are…
Aldian
  • 2,592
  • 2
  • 27
  • 39
0
votes
1 answer

Transaction with inserts retried due to simultaneous select

I am running into an issue with transactions in cockroachDB. Periodically, a table is rebuilt using external data. My approach is to drop the table and re-populate the table from scratch within a transaction. I noticed that if a SELECT statement is…
Nikola
  • 11
  • 1
0
votes
1 answer

Unexpected behaviour of the Serializable isolation level

Test setup I have a SQL Server 2014 and a simple table MyTable that contains columns Code (int) and Data (nvarchar(50)), no indexes created for this table. I have 4 records in the table in the following manner: 1, First 2, Second 3, Third 4,…