eolas/Databases/ACID_principle.md

36 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
2023-02-10 18:22:04 +00:00
tags: [relational-databases]
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
> A database is a collection of organised data that can be efficiently stored,
> sorted, and searched.
2022-04-23 13:26:53 +01: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-04-23 13:26:53 +01:00
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.
2022-08-16 11:58:34 +01:00
- **consistency**
- before data can be changed in a database, it must be validated against a set
of rules
2022-08-16 11:58:34 +01:00
- **isolation**
- databases allow multiple changes at the same time, but each change is
isolated from others
2022-08-16 11:58:34 +01:00
- **durability**
- once a change has been made, the data is safe, even in the event of system
failure
2022-08-16 11:58:34 +01:00
> Databases will have mechanisms for **backup**, **distribution**, and
> **redundancy**, to ensure data is not lost.