Pcornel
Browse topics
Options
Recent
Favorites
Databases · Technical reference

ACID Properties

Direct answer

ACID: Atomicity (all or nothing), Consistency (constraints hold), Isolation (concurrent transactions don't interfere beyond the chosen level), Durability (committed data survives crashes).

When to use this

Use it to reason about transaction guarantees and their trade-offs.

First 30 seconds

1. Durability settings: SHOW synchronous_commit; / SHOW VARIABLES LIKE 'innodb_flush_log_at_trx_commit';.

2. Isolation level of sessions.

3. Constraints defined.

4. Application uses transactions where needed.

5. Test crash recovery in lab.

Operational verification

transaction → atomic commit → constraints checked → isolated reads → flushed to durable storage

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
MariaDB / MySQL / PostgreSQL / Microsoft SQL Server concepts
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformMariaDB / MySQL / PostgreSQL / Microsoft SQL Server concepts
Scope / prerequisiteUse it to reason about transaction guarantees and their trade-offs.
What next?2 suggested next steps
Evidence0
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 How to verify Verify boundary

Read the durability settings on the live server. Confirm the application uses explicit transactions for multi-statement changes. Check the storage layer honours fsync (no unsafe write caches).

Step 2 Common failures Narrow the fault

Relaxed durability (for example synchronous_commit=off) can lose the last commits on crash. Autocommit mode makes each statement its own transaction, so a failure halfway leaves partial changes. Non-transactional tables ignore ROLLBACK.

Key points

Durability depends on settings like fsync, synchronous_commit, innodb_flush_log_at_trx_commit — disabling them trades safety for speed. Isolation level decides which anomalies are possible.

Key checks
  • SHOW synchronous_commit; — first check for this topic
  • psql -c "SELECT now(), version();" — PostgreSQL reachable and version
  • mysql -e "SELECT NOW(), VERSION();" — MariaDB/MySQL reachable and version
  • sqlcmd -S <server> -Q "SELECT @@VERSION" — SQL Server reachable and version
ReferenceWhat it is1 section · depth on demand

How it works

Databases write changes to a write-ahead log before changing data files. On COMMIT the log is flushed to disk; after a crash the server replays the log to redo committed work and undo the rest. Isolation is provided by locks, MVCC snapshots or both.

ReferenceImportant terms & boundaries3 sections · depth on demand

ACID in practice

PropertyMeaningMechanism
AtomicityAll or nothingUndo/rollback, transaction log
ConsistencyConstraints holdKeys, checks, triggers
IsolationConcurrent transactions do not interfere (per level)Locks, MVCC
DurabilityCommitted data survives crashesWAL/redo log flushed before commit

Durability depends on settings: innodb_flush_log_at_trx_commit=1 (MySQL) and synchronous_commit=on (PostgreSQL) — relaxing them gains speed at the cost of losing recent commits on a crash.

In depth

Where each ACID property actually comes from

PropertyProvided byBreaks when
AtomicityTransaction log + rollback (undo or MVCC visibility)Application commits half the work in separate transactions
ConsistencyConstraints, foreign keys, triggersRules exist only in application code
IsolationLocks and/or MVCC snapshots at the chosen isolation levelLevel too low for the access pattern
DurabilityLog flushed to stable storage before COMMIT returnsfsync disabled, write cache without power protection

The durability chain

A COMMIT is only durable if every layer below it honours flush requests: database → OS page cache → filesystem → controller cache → disk. A RAID controller or SSD with a volatile write cache that ignores flushes can lose committed transactions on power loss even when the database is configured correctly.

Settings that trade durability for speed

EngineSettingEffect
PostgreSQLsynchronous_commit = offRecent commits can be lost on crash; no corruption
PostgreSQLfsync = offCrash can corrupt the cluster — never in production
MySQL InnoDBinnodb_flush_log_at_trx_commit = 2Log written at commit, flushed once a second; up to ~1 s lost on OS crash
MySQLsync_binlog = 0Binary log may lose transactions the engine kept
SQL ServerDelayed durabilityCommits acknowledged before the log is hardened

Worked check

SHOW synchronous_commit;  SHOW fsync;                         -- PostgreSQL
SELECT @@innodb_flush_log_at_trx_commit, @@sync_binlog;       -- MySQL (1 and 1 = fully durable)
Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Common mistakes

  • Assuming every engine/configuration gives full durability (check fsync settings).
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
acid propertiesacid transactionswrite-ahead log durability
Confirmation

Confirm action

Continue?