Understanding Database isolation level via examples — MySQL and Postgres
If you are familiar with Transactional Databases, you probably worked with the ACID properties. In the context of transaction processing, the acronym ACID refers to the four key properties of a transaction: atomicity, consistency, isolation, and durability. Here we want to talk about Isolation Levels.
What is Isolation Level?
Transactions specify an isolation level that defines the degree to which one transaction must be isolated from resource or data modifications made by other transactions. Isolation levels are described in terms of which concurrency side-effects, such as dirty reads or phantom reads, are allowed[1].
When working with database transactions, we must ask ourselves; which isolation level is more relevant for our use case. If we don’t choose the right one for our queries, it might cause a problem in the future, which even can have a huge effect on business. So today, we will explore deeper and more in detail to know how each level of isolation work in PostgreSQL and MySQL.
Keep in mind; Although isolation levels are well-defined standards, each database engine might implement them differently, which we will explain in this article.