eolas/Databases/ACID_principle.md

25 lines
1.2 KiB
Markdown
Raw Normal View History

2022-04-23 13:26:53 +01:00
---
2022-08-16 11:58:34 +01:00
categories:
2022-04-23 13:26:53 +01:00
- Databases
2022-12-08 20:18:56 +00:00
tags: [relational-database]
2022-04-23 13:26:53 +01:00
---
2022-12-08 20:18:56 +00:00
# ACID principle
2022-08-05 09:00:04 +01:00
2022-08-16 11:58:34 +01:00
> A database is a collection of organised data that can be efficiently stored, sorted, and searched.
2022-04-23 13:26:53 +01:00
2022-12-08 20:18:56 +00:00
How the data is organised will often determine the _type_ of database used. There are many different types of database; some examples of the different types are relational, object-orientated, graphical, NoSQL, and distributed. All should meet the principles of ACID.
2022-04-23 13:26:53 +01:00
To ensure the integrity of a database, each change or transaction must conform to a set of rules known as ACID:
2022-08-16 11:58:34 +01:00
- **atomicity**
- when changing data within a database, if any part of the change fails, the whole change will fail and the data will remain as it was before the change was made; this is a safeguard that prevents partial records being created.
- **consistency**
- before data can be changed in a database, it must be validated against a set of rules
- **isolation**
- databases allow multiple changes at the same time, but each change is isolated from others
- **durability**
- once a change has been made, the data is safe, even in the event of system failure
> Databases will have mechanisms for **backup**, **distribution**, and **redundancy**, to ensure data is not lost.