ACID(SQL) vs BASE(No-SQL) properties
ACID (Atomicity, Consistency, Isolation, Durability)
SQL follows the ACID model
- Atomicity: Either all transactions or nothing. There are three stages to any transaction: 1) Check balance 2) Deduct balance 3) Update balance. If any of the stages fails, the transaction will come to a halt and the accounts will be updated to their previous condition.
- Consistency: It ensures that no transaction ever leaves the database half-completed. It checks the correctness of the data.
- Isolation: Transactions are kept distinct from one another until they are completed.
- Durability: It ensures that the database will maintain track of outstanding changes in order for the server to recover from an unplanned shutdown(Data will never lose). In other words, due to durability, we will never lose our data.
Database which follows ATOM model: SQL Server, Oracle, MySQL, PostgreSQL
BASE (Basically Available Soft state Eventually consistent)
No-SQL follows the BASE model (To grasp this concept, I recommend learning Basically Available first, then Eventually Consistent, and then Soft-state)
- Basically Available: Large database items will be divided into small containers at this point, and each container will include replicated values from other containers. In the event that one of the containers fails, the query will be retrieved from the other container, which has the replicated value of the failed container.
- Soft-state: Even if we are not querying into the database at this point, the database will be querying due to the updating of replicated data in the database.
- Eventually consistent: It indicates that when we update values in the original container, the replicated value in other containers will take some time to update.