Online College Courses for Credit

+
Durability

Durability

Rating:
(0)
Author: Sophia Tutorial
Description:

Recall how the durability property ensures that once a transaction is completed, the changes are commited and cannot be reverted even if the system fails.

(more)
See More
Fast, Free College Credit

Developing Effective Teams

Let's Ride
*No strings attached. This college course is 100% free and is worth 1 semester credit.

47 Sophia partners guarantee credit transfer.

299 Institutions have accepted or given pre-approval for credit transfer.

* The American Council on Education's College Credit Recommendation Service (ACE Credit®) has evaluated and recommended college credit for 33 of Sophia’s online courses. Many different colleges and universities consider ACE CREDIT recommendations in determining the applicability to their course and degree programs.

Tutorial

what's covered
This tutorial explores the durability property in a transaction and how it affects the database.

Durability is the last property to explore further. It is one of the easier-to-follow properties. This property focuses on ensuring that once the data from the transaction has been saved/committed to the database, it will stay in place and the data will not be affected by system failure. This means that any completed transactions should be recorded and saved in memory.

Given our example where Jennifer would like to make a payment to Randall for $100 through an account transfer. This transaction would be a balance transfer between two accounts at two different branches at the same bank. Let us review what the transaction would look like:

  1. Jennifer’s (10) account would be deducted by $100.
  2. The banking location that Jennifer has her account would have their location’s account deducted by $100.
  3. The banking location that Randall(50) has his account would be increased by $100.
  4. Randall’s account would be increased by $100.

Let us look at the transaction in SQL:

BEGIN;

UPDATE customer_account
SET balance = balance – 100
WHERE account_id = 10;

UPDATE branch_account
SET balance = balance – 100
WHERE branch_id = (SELECT branch_id FROM customer_account where account_id = 10);

UPDATE branch_account
SET balance = balance + 100
WHERE branch_id = (SELECT branch_id FROM customer_account where account_id = 50);

UPDATE customer_account
SET balance = balance +100
WHERE account_id = 50;

COMMIT;

There is the transfer put in place and has been successfully transferred, the changes that are made should be reversed regardless if there are any system failures. In essence, once the transaction has completed execution, the updates and changes to the database are stored in and written to the database. These changes will still persist even if the system fails as those updates are now permanent. The effects of the account transfer would never be lost. Durability is only considered after the transaction has occurred which is after the COMMIT has been executed. Anything that occurs prior to that is part of another ACID property.

summary
The durability property ensures that once a transaction is completed and committed, the data is permanent and never lost even with a system failure.