InterviewSolution
| 1. |
What are ACID properties in Database Management Systems? |
|
Answer» The term "ACID" is an acronym for Atomicity, Consistency, Isolation and Durability. A transaction is a logical unit of work that accesses and, in CERTAIN cases, updates the contents of a database. Read and write operations are used by transactions to access data. Certain properties are followed before and after a transaction in order to preserve consistency in a database. ACID characteristics are what they are CALLED. Let us take a look at each of these characteristics in detail:
The 'All or nothing rule' is another name for atomicity. Consider the following transaction T, which consists of two transactions: T1 and T2. 100 dollars transferred from account X to account Y. If a transaction fails after T1 but before T2 (for example, after write(X) but before write(Y)), the amount deducted from X but not added to Y is deducted. As a result, the database is in an inconsistent condition. As a result, the transaction must be completed in its entirety to guarantee that the database state is valid.
Before T, the total is 500 + 200 = 700. As a result, the database is consistent. When T1 succeeds but T2 fails, there is inconsistency. As a result, T is not complete.
Let us take an example to understand Isolation. Let X = 500 and Y = 500 and let there be two transactions T and T". Assume T has been running until Read (Y), at which point T" begins. As a result of this interleaving, T" reads the right value of X but the wrong value of Y, and the sum computed by T": (X+Y = 50, 000+500=50, 500) is inconsistent with the sum at the end of the transaction: T = 50, 000 + 450 = 50, 450 (X+Y = 50, 000 + 450 = 50, 450). Due to the loss of 50 units, this causes database discrepancy. As a result, transactions must be performed in isolation, and changes should only be seen after they have been written to the main memory.
The ACID properties, taken together, provide a mechanism for ensuring the correctness and consistency of a database in such a way that each transaction is a group of operations that acts as a single unit, produces consistent results, is isolated from other operations, and the updates it makes are durably stored. |
|