Questions tagged [transaction]

A mechanism for committing a consistent set of changes into a database atomically.

Transactions are the primary unit of concurrent work on a database, allowing a set of changes to be committed into the database atomically. Most database systems guarantee a set of invariants within a transaction called ACID properties.

Atomicity guarantees that all changes in a transaction guarantees that all changes in the transaction will be committed or rolled back - a transaction is never partially applied.

Consistency guarantees that the transaction cannot leave data in an invalid state, including validity checks applied by database constriants.

Isolation guarantees that a transaction cannot interfere with data being used by another transaction. In practice, this constraint is often relaxed to trade consistency for performance by setting the isolation level of the transaction.

Durability guarantees that if a transaction is reported to the client as being committed that the database manager can guarantee that transaction has been committed and the changes stored permanently.

Within a simple transaction the semantics implied by ACID are fairly straightforward, but they can get more complex with more complex transaction semantics.

Distributed transactions guarantee ACID properties across multiple database systems or other resource managers for a transaction through a protocol known as two-phase commit. In this type of protocol each resource manager1 is asked to guarantee the ability to commit and then subsequently asked to actually commit the transaction. The transaction is not reported as committed until all resource managers have reported successful commits.

Nested or chained transactions allow parts of a transaction to be committed, but then rolled back if an error is encountered at a higher level. Rollback at any level aborts the whole transaction. This mechanism is useful for ensuring consistency across a complex transaction involving multiple operations.

Autonomous transactions allow certain updates to break off from the parent transaction context and commit autonomously. This is useful for (for example) ensuring that loggng information persists when an error causes the rollback of a parent transaction. Not all DBMS platforms support autonomous transactions.

The definitive book on transaction processing systems architecture is Grey and Reuters Transaction Processing: Concepts and Techniques (ISBN 978-1558601901).

1In transaction processing terminology a resource manager is something like a database management system that participates in a distributed transaction.

756 questions
5
votes
2 answers

Lost Update Understanding

https://habr.com/en/company/postgrespro/blog/467437/ gives the following example of a Lost Update: For example, two transactions are going to increase the amount on the same account by ₽100 (₽ is the currency sign for Russian rouble). The first…
Kevin Meredith
  • 517
  • 1
  • 5
  • 13
3
votes
2 answers

What is the correct term to describe a "persistent transaction"?

I'm kind of a the administrator of a zero-administration OODBMS, but mostly I do programming. I remember reading years ago about some SQL database that had a concept of something like a permanent transaction. It might have been Sybase. Anyway, what…
3
votes
2 answers

read before write transaction

Talking about transactions (db transactions), does a read operation have always precede a write operation? That's obvious, isn't it? Thanks in advance *Of course my question doesn't take into account any specific locking protocol or whatever it's…
user962800
  • 179
  • 1
  • 4
1
vote
0 answers

Time-Order preserving concurrent reservation of non distinguishable items

Problem statement: Its very similar to a traditional booking system, however it is a bit different. There are non-distinguishable items (e.g. like money on bank account) of different types that can be obtained by a user. If a user selects an item it…
Thomas
  • 11
  • 1
1
vote
2 answers

How do transactions help resilience to system failure?

I understand transactions were developed to meet two requirements: Concurrent DB access Resilience to system failures I understand how the concurrency issue is motivated; to overcome the database consistency problem. However, I have a question: …
user89879
0
votes
1 answer

Case of irrecoverable error in transaction

According to an exam question,which may lead to an irrecoverable error: 1.A transaction writes a data item after it is read by an uncommitted transaction. 2.A transaction a data item after it is read by an uncommitted transaction. 3.A transaction…
user1369975
  • 217
  • 5
  • 9
0
votes
0 answers

How are blind writes recoverable in a transaction schedule?

Consider the following schedule - T1 T2 R(A) W(A) R(A) W(A) Commit Commit I understand that this schedule is non-recoverable, because if a failure occurs between the two commits, then we can't rollback the operations…
0
votes
0 answers

when should we use the read uncommited

I am reading the database isolation level, and I found the read uncommited isolation level. my question is: what the purpose of the read uncommited isolation level? when should we use the read uncommited level? all the document said the it is…
Dolphin
  • 775
  • 4
  • 18
  • 34
0
votes
1 answer

Transaction question

I have a question. c stands for Commit, a stands for Abort, T is a transaction (db Transaction) Is the following sentence true? either c or a belong to T In my opinion the sentence is true since if you have Abort you cannot Commit...and also the…
user962800
  • 179
  • 1
  • 4