Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do database vendors implement transactions?

Tags:

When working with database it is often essential to use transactions. Say for example that I want to transfer a certain amount of money from account A to account B. This involves two queries:

  • decrease the money in account A
  • increase it in account B.

In theory I can make the queries separately, but errors happen. So, to be sure, I can pack the two queries inside a transaction and be sure that either both operations end regularly or nothing has changed at all. No money disappears or is created.

The problem is that it seems to me that this only shifts the responsibility from me to the database vendor. Now it is up to the database to make both operations and be sure that either both are made or nothing has changed. And the database developers face the same problems that errors happen.

What techniques do database vendors use to ensure safety for transactions?

like image 365
Andrea Avatar asked Mar 19 '11 22:03

Andrea


People also ask

How are transactions implemented in databases?

Steps in a TransactionLocate the record to be updated from secondary storage. Transfer the block disk into the memory buffer. Make the update to tuple in the buffer buffer. Write the modified block back out to disk.

How are transactions implemented in SQL?

The transaction remains in effect until a COMMIT or ROLLBACK statement has been explicitly issued. This means that when, say, an UPDATE statement is issued on a specific record in a database, SQL Server will maintain a lock on the data scoped for data modification until either a COMMIT or ROLLBACK is issued.

What do database vendors do?

About the Vendor Database. The Vendor database stores information about your vendors. Because the system is fully integrated, the information you enter in the Vendor database is automatically supplied to other parts of the system.

What is transaction management in database?

Transaction management [1, 2] refers to the tasks of processing multiple transactions issued by various clients of a database server in such a way that the ACID contract can be fulfilled, that is, the properties of atomicity, consistency preservation, isolation, and durability of each individual transaction can be ...


1 Answers

The ACID - Implementations page on wikipedia will get you started on write-ahead logging, shadow paging and multi-version concurrency control. Follow the links to find more.

Each DBMS vendor implements their own algorithms, often several different ones depending on the context, full ACID or relaxed requirements, distributed transaction consistency requirements etc...

like image 167
Mat Avatar answered Sep 23 '22 19:09

Mat