Before we begin to discuss isolation
, it is important to learn about some terminologies. Let's dive into transactions
, concurrency
, and read phenomena
.
Transactions
Transactions
refer to a collection of several small operations that aim to perform a single operation. In DBMS terms, a single transaction runs multiple queries
on a database system to complete a task.
Let's understand this with an example. Suppose you want to transfer funds from one bank account to another. From the perspective of a user, it's a simple task, as you only need to select the "funds transfer" option. However, from the database's perspective, a series of queries will get run, like checking the balance, updating the sender's bank balance, updating the receiver's bank balance, and generating a transaction record. All these small operations make up a single transaction
.
An important responsibility of databases is to ensure that all the transactions are performed successfully. Successful completion of transactions lead to a permanent change in the database as commits
. In the case of failure at any point during the transaction, the database must revert to its original state, without any loss of data. This reverting back of states is known as rollback
.
Another important thing to note about transactions are the permitted operations. A transaction can perform either read
or write
values in database tables. The queries
performed on databases utilize these operations for analyzing and processing data. In short, databases need to be very careful with handling and processing their data, as any unexpected failures may hinder tasks that need to be performed.