04/02/2024
๐ ๐จ๐ป๐น๐ผ๐ฐ๐ธ๐ถ๐ป๐ด ๐๐ฎ๐๐ฎ๐ฏ๐ฎ๐๐ฒ ๐ฅ๐ฒ๐น๐ถ๐ฎ๐ฏ๐ถ๐น๐ถ๐๐: ๐จ๐ป๐ฑ๐ฒ๐ฟ๐๐๐ฎ๐ป๐ฑ๐ถ๐ป๐ด ๐๐๐๐ ๐ฃ๐ฟ๐ผ๐ฝ๐ฒ๐ฟ๐๐ถ๐ฒ๐ ๐
Ever wondered how databases ensure the reliability and integrity of your data, especially in critical applications like banking and healthcare? Let's delve into the world of ACID properties โ the backbone of database transactions!
๐ญอ.อ อ๐ชอ๐ตอ๐ฎอ๐อ อ๐ถอ๐อ อ๐อ๐อ๐อ๐อ อ๐ฃอ๐ฟอ๐ผอ๐ฝอ๐ฒอ๐ฟอ๐อ๐อ อ๐ผอ๐ณอ อ๐อ๐ฎอ๐อ๐ฎอ๐ฏอ๐ฎอ๐อ๐ฒอ:อ
ACID is like a set of rules that databases follow to make sure they handle data reliably and safely. It stands for:
๐๐๐ผ๐บ๐ถ๐ฐ๐ถ๐๐: Treats a set of operations as one whole thing. Either all of them happen, or none of them.
Description:
Start Transaction:
The transaction begins.
Execute Operations: Multiple operations are executed as part of the transaction.
Checkpoint:
A checkpoint is reached. At this point, the system ensures that all operations have been completed successfully.
Commit:
If all operations succeed, the changes are committed to the database. If any operation fails, a rollback is performed, and the changes are discarded.
๐๐ผ๐ป๐๐ถ๐๐๐ฒ๐ป๐ฐ๐: Makes sure that the database is in a valid state before and after transactions.
Description:
Start Transaction:
The transaction begins.
Execute Operations:
Multiple operations are executed as part of the transaction.
Consistency Check:
After each operation, a consistency check is performed to ensure that the database remains in a consistent state.
Commit:
If the consistency check passes for all operations, the changes are committed to the database. If any consistency check fails, a rollback is performed
๐๐๐ผ๐น๐ฎ๐๐ถ๐ผ๐ป: Keeps different transactions separate, so they don't interfere with each other.
Description:
Start Transaction (T1): Transaction T1 begins.
Start Transaction (T2): Concurrently, another transaction T2 begins.
Execute Operations (T1 and T2): Both transactions execute their respective operations concurrently.
Isolation: The operations of each transaction are isolated from each other, and neither is aware of the other's changes until they are committed.
Commit (T1 and T2): Each transaction independently commits its changes to the database.
๐๐๐ฟ๐ฎ๐ฏ๐ถ๐น๐ถ๐๐: Once a transaction is complete, its changes are permanent, even if something goes wrong.
Description:
Commit: The transaction commits its changes to the database.
Write to Log: The committed changes are written to a transaction log or journal.
Checkpoint: Periodically, the system creates a checkpoint, ensuring that all committed changes are permanently stored.
Recovery: In the event of a failure, the system can use the transaction log to recover the database to its last consistent state.
Imagine ACID like baking a cake. You want all the ingredients mixed (atomicity), the cake to taste good (consistency), each step to be done without messing with other recipes (isolation), and once it's baked, it stays baked (durability).
Please give us a follow if you love this
Clever Engineer