@sargonpiraev

Transactions

Created 1 min readseed · 1/5#database

A transaction groups multiple read/write operations into one logical unit: either all effects commit together, or none do.

That unit is what ACID properties attach to. In practice you choose an isolation level that trades off correctness under concurrency (fewer anomalies) against throughput and latency.

Keep transactions short: long-running work inside a transaction holds locks or prevents cleanup work (for systems that use MVCC). The anti-pattern is BEGIN, then slow network calls, then COMMIT.

For PostgreSQL-specific behavior (savepoints, default isolation, long transactions and autovacuum), see Postgres transactions.