100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Database

ACID and Isolation Levels

How PostgreSQL guarantees Atomicity, Consistency, Isolation, and Durability, and how the four SQL isolation levels trade off correctness against concurrency.

Transactions & ConcurrencyIntermediate10 min readJul 10, 2026
Analogies

What ACID Actually Guarantees

ACID is a contract a database makes with your application: Atomicity means a transaction's writes either all happen or none do, Consistency means the database moves from one valid state to another (constraints, foreign keys, checks all hold), Isolation means concurrent transactions don't see each other's half-finished work, and Durability means once COMMIT returns, the data survives a crash. PostgreSQL implements atomicity and durability primarily through the write-ahead log (WAL): every change is logged before it is applied, and on crash recovery WAL is replayed to restore the exact committed state.

🏏

Cricket analogy: A run is only added to the scoreboard once the third umpire confirms a boundary via replay (durability), and a batter given out mid-over doesn't retroactively un-happen if the innings is interrupted by rain — the scorecard state is always consistent (atomicity) at any stoppage.

The Four SQL Isolation Levels

The SQL standard defines four isolation levels — Read Uncommitted, Read Committed, Repeatable Read, and Serializable — that permit progressively fewer anomalies. PostgreSQL treats Read Uncommitted as an alias for Read Committed (it never allows dirty reads), so in practice you choose among three real levels. Read Committed is the default: each statement sees a fresh snapshot of committed data at the moment it starts, so two SELECTs in the same transaction can return different results if another transaction commits in between (a non-repeatable read).

🏏

Cricket analogy: Read Committed is like checking the live scoreboard app before each ball you bowl — you always see the latest confirmed score, but if you check again after two balls, the total may have changed because runs were added in between.

Repeatable Read, PostgreSQL's implementation of snapshot isolation, takes one snapshot at the start of the transaction and every statement in that transaction sees that exact same snapshot, eliminating non-repeatable reads and phantom reads. Serializable adds predicate locking on top of Repeatable Read and guarantees the outcome is equivalent to some serial (one-at-a-time) execution of all concurrent transactions; PostgreSQL implements this as Serializable Snapshot Isolation (SSI), which detects dangerous read-write dependency cycles and aborts one transaction with a serialization_failure error rather than allowing an anomaly, meaning your application must be prepared to retry.

🏏

Cricket analogy: Repeatable Read is like a commentator working from the scorecard printed at the start of the innings — even if the live score changes, their analysis stays consistent with that one fixed snapshot for the whole segment.

sql
-- Read Committed (default): each statement gets a fresh snapshot
BEGIN;
SELECT balance FROM accounts WHERE id = 1;  -- sees committed state at this moment
-- ... another session commits a change here ...
SELECT balance FROM accounts WHERE id = 1;  -- may return a DIFFERENT value
COMMIT;

-- Serializable: whole transaction sees one snapshot, conflicts abort
BEGIN ISOLATION LEVEL SERIALIZABLE;
SELECT balance FROM accounts WHERE id = 1;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;
COMMIT;
-- If a dangerous concurrent dependency is detected, PostgreSQL raises:
-- ERROR: could not serialize access due to read/write dependencies
-- SQLSTATE 40001  the application must retry the whole transaction.

Serializable transactions can fail with SQLSTATE 40001 even when no ordinary lock conflict occurred — this is expected behavior, not a bug. Every application using SERIALIZABLE isolation must wrap the transaction in a retry loop; PostgreSQL will never silently allow a non-serializable outcome.

PostgreSQL never permits dirty reads at any isolation level — the Read Uncommitted level exists only for SQL-standard compatibility and behaves identically to Read Committed.

  • ACID = Atomicity, Consistency, Isolation, Durability; WAL is the mechanism behind atomicity and durability.
  • PostgreSQL supports Read Committed (default), Repeatable Read, and Serializable — Read Uncommitted behaves like Read Committed.
  • Read Committed re-reads committed data on every statement, permitting non-repeatable reads.
  • Repeatable Read takes one snapshot for the whole transaction, eliminating non-repeatable and phantom reads.
  • Serializable (SSI) guarantees a result equivalent to some serial ordering, aborting transactions that create dangerous dependency cycles.
  • Serializable transactions can fail with SQLSTATE 40001 and must be retried by the application.
  • Higher isolation levels reduce anomalies but increase the chance of serialization conflicts and retries.

Practice what you learned

Was this page helpful?

Topics covered

#Database#PostgreSQLAdvancedStudyNotes#ACIDAndIsolationLevels#ACID#Isolation#Levels#Actually#SQL#StudyNotes#SkillVeris

Frequently Asked Questions

21 categories · pick one to explore

Where can I get free study notes for programming and tech subjects?
SkillVeris offers completely free study notes covering programming and tech subjects, with no signup fees or paywalls. The notes are structured by course and topic, written for quick understanding, and enriched with the Learn Through Hobbies analogy method, so you can revise concepts through cricket, music, gaming, cooking and more.
Are SkillVeris study notes good for exam revision?
Yes, the study notes are designed for efficient revision: each topic answers its heading immediately, keeps explanations concise, and links to related glossary terms and cheat sheets. Students preparing for university exams or certification tests use them as quick revision notes because they distil concepts without the padding of full textbooks.
What subjects do the free study notes cover?
The study notes span the platform's main domains, including AI and machine learning, Python and programming, web development, DevOps, cloud, security and databases. Coverage mirrors the 37 live courses, so notes exist for the topics you are actually studying, and new note sets are added as courses launch.
How are SkillVeris study notes different from regular textbooks?
The notes are answer-first, concise and free, whereas textbooks are long and often expensive. Each section explains one concept directly, then reinforces it through selectable hobby analogies like cricket or cooking. Notes also cross-link to the glossary, blog and cheat sheets, letting you jump to related material instantly instead of flipping pages.
Can I use the developer study material without creating an account?
The study notes are free to access, and SkillVeris does not charge anything for its developer study material at any point. Browsing notes is straightforward from the Study Notes section, and if you want progress tracking, certificates and AI Mentor conversations tied to your learning, a free account unlocks those extras.
Do the study notes explain concepts with analogies?
Yes, this is a signature SkillVeris feature. Study notes use the Learn Through Hobbies method, explaining technical concepts through analogies from twelve domains including cricket, music, gaming, photography, travel, movies, fitness, chess, cooking, finance, business and sports. You can switch the analogy domain instantly to whichever hobby makes the concept click.
Are the revision notes suitable for last-minute exam preparation?
Yes, revision notes on SkillVeris work well for last-minute preparation because every section states the answer in its first sentences, so skimming is genuinely effective. Pair them with the relevant cheat sheet for formulas and syntax, and use the glossary for any unfamiliar term you meet while cramming.
Is there free study material for AI and machine learning?
Yes, SkillVeris provides free study notes across its AI and ML catalogue, covering Python for AI, deep learning frameworks like PyTorch and TensorFlow, Hugging Face Transformers, Large Language Models, RAG, AI agents and MLOps. All of it is free, making it a strong resource for Indian students and global learners alike.
Can beginners understand the study notes, or are they for experts?
Beginners can absolutely use them. The notes are written in plain language, define terms as they appear, and lean on hobby analogies to make abstract ideas concrete. Difficulty scales with the underlying course level, so beginner-course notes stay gentle while advanced-course notes go deeper, and the glossary supports you throughout.
How do study notes connect with SkillVeris courses?
Study notes are organised by course and topic, so they map directly to the structured courses and their 24–40-lesson curriculum. Many learners study a lesson first, then use the matching notes for revision before module assessments and the final exam, where 80 percent is required to pass and earn the certificate.
Are there study notes for Python specifically?
Yes, Python is well covered through notes tied to the Python-focused courses, including Python for AI and ML. Topics span fundamentals through applied machine learning usage. You can reinforce the notes with Python practice in Code Lab, which runs code in your browser with no installation required.
Do the study notes include code examples?
Yes, study notes include code examples wherever a concept is best shown in code, alongside explanations, key points and analogies. Reading a snippet in the notes and then reproducing it yourself in Code Lab is an effective loop, since Code Lab lets you run code in the browser across six languages.
How often is new study material added to SkillVeris?
Study material grows alongside the course catalogue. Whenever new courses join the platform's 37 live courses, matching study notes, glossary entries and cheat sheets are added so the resources stay in sync. Existing notes are also refined over time, so it is worth revisiting topics you studied earlier.
Can I use SkillVeris notes to prepare for technical interviews?
Yes, the notes make excellent interview revision because they compress each concept into direct, answer-first explanations, which mirrors how you should answer interview questions. Combine them with the SkillVeris interview questions feature, which includes readiness scoring, to test whether your revision has actually made you interview-ready.
Are the study notes mobile-friendly for studying on the go?
Yes, the study notes are built to load fast and read comfortably on mobile devices, so you can revise during a commute or between classes. Sections are short and answer-first, which suits small screens, and analogy switching works on mobile too, letting you study anywhere without carrying books.
What is the difference between study notes and cheat sheets?
Study notes explain concepts in depth with context, examples and analogies, making them ideal for learning and revision. Cheat sheets are compact quick-reference summaries of syntax, commands and key facts, ideal once you already understand a topic. Most learners study the notes first, then keep the cheat sheet handy while coding.
Do study notes help if I am stuck on a course lesson?
Yes, reading the matching study notes often clarifies a lesson because the same concept is explained from a different angle, frequently with a different analogy. If you are still stuck, ask the AI Mentor, which answers 24/7 at Quick, Detailed or Deep-dive depth until the idea genuinely makes sense.
Is there free study material for DevOps and cloud topics?
Yes, SkillVeris carries free study notes for DevOps and cloud topics as part of its coverage across 37 live courses. The material suits learners following the DevOps Engineer or Cloud Engineer paths, and it links to related glossary terms and cheat sheets so you can revise the whole toolchain in one place.
Can school or college students in India use these notes for projects?
Yes, students across India and worldwide use SkillVeris notes for coursework, projects and exam preparation, and everything is free, which matters for student budgets. The notes explain concepts clearly enough to cite in project reports, and Code Lab lets you prototype the project code directly in your browser.
How should I combine study notes with other SkillVeris resources?
A proven loop: learn from a course lesson, revise with the matching study notes, look up unfamiliar terms in the glossary, keep the cheat sheet open while practising in Code Lab, and quiz yourself with interview questions. The AI Mentor fills any remaining gaps 24/7, at whatever depth you need.

What Learners Say

Real journeys from the SkillVeris community — swipe for more.

SkillVeris taught me Python through Cricket. Now I’m building real projects and feeling confident!
Arjun S. · B.Tech Student
The best platform for hobby-based learning. Concepts finally stick.
Priya R. · Data Analyst
I went from zero coding to a portfolio of projects — all by learning through my love for gaming. Landed my first internship!
Kabir M. · CS Undergraduate
Trending Topics50 popular tags — tap to explore
Trending CoursesAll 37 free courses — tap to browse