TutorialsAIPostgreSQLMySQL

What Is ACID in Databases? A Plain-English Explanation

If you've been around databases long enough, you've seen the acronym ACID thrown around usually in architecture discussions, job interviews, or sales pitche...

Dr. Elena Vasquez· AI Research LeadApril 1, 20268 min read

If you've been around databases long enough, you've seen the acronym ACID thrown around usually in architecture discussions, job interviews, or sales pitches for "enterprise-grade" storage systems. But for many people outside of database engineering, what it actually means stays fuzzy.

ACID is not a feature you turn on. It's a set of four properties that define how a database handles transactions the units of work that need to succeed or fail as a complete whole. Understanding ACID is useful for anyone who builds on top of a database, even if you never write a line of database engine code. It tells you what guarantees you can rely on when things go wrong.

The Problem ACID Solves

Start with why ACID exists. Imagine a bank transfer: you move $500 from account A to account B. The operation involves two separate writes a debit on one account and a credit on the other. What happens if the system crashes between the two writes? The $500 has left account A but hasn't arrived in account B. It's gone.

This is the classic "partial failure" problem. Databases need a way to ensure that a group of operations either all succeed or all fail with no in-between states leaking into permanent storage. ACID is the set of properties that make this possible.

A: Atomicity

Atomicity means that a transaction is treated as a single unit. Either every operation in the transaction completes, or none of them do. There's no partial success.

In the bank transfer example: if the system crashes after debiting account A but before crediting account B, the database rolls back the debit. When the system recovers, both accounts are as if the transfer never started.

Practically, this means you can group multiple SQL statements into a transaction and trust that they won't leave the database in a half-finished state:

BEGIN;

UPDATE accounts SET balance = balance - 500 WHERE id = 'account_a';
UPDATE accounts SET balance = balance + 500 WHERE id = 'account_b';

COMMIT;

If either UPDATE fails, the ROLLBACK is triggered automatically and neither change persists.

C: Consistency

Consistency means that a transaction takes the database from one valid state to another valid state. It never leaves the data in a state that violates the rules you've defined constraints, foreign keys, unique indexes, check constraints.

If you have a constraint that says account balances can't go negative, and a transaction tries to debit more than the available balance, the transaction will fail. The constraint is enforced. The database stays consistent.

This is the property most under the developer's control. You define the rules (constraints, triggers, application logic), and the database enforces them transactionally. Consistency is only as good as the rules you've put in place.

A common misconception: consistency doesn't mean "all data is the same everywhere" that's a different concept (eventual consistency in distributed systems). In ACID, consistency means your data integrity rules are never broken.

I: Isolation

Isolation is about what happens when multiple transactions run at the same time. In a busy application, hundreds of transactions may be running concurrently. Isolation controls how much one transaction can "see" of another transaction's in-progress work.

If transaction A is updating a row and transaction B reads that same row before A commits, what does B see? The answer depends on the isolation level configured on the database.

SQL standard isolation levels, from weakest to strongest:

  • Read Uncommitted can see uncommitted changes from other transactions ("dirty reads"). Fastest but most dangerous.
  • Read Committed only sees committed data. Default for PostgreSQL, Oracle.
  • Repeatable Read if you read a row twice in the same transaction, you get the same value both times. Default for MySQL/InnoDB.
  • Serializable transactions behave as if they ran one after another in sequence. Most strict, highest overhead.
  • -- PostgreSQL: set isolation level for a transaction
    BEGIN TRANSACTION ISOLATION LEVEL REPEATABLE READ;
    
    SELECT balance FROM accounts WHERE id = 'account_a';
    -- do some application logic...
    SELECT balance FROM accounts WHERE id = 'account_a';
    -- guaranteed to return the same value as above
    
    COMMIT;

    Most applications work fine at Read Committed. If you're building financial systems, inventory management, or anything where two concurrent reads of the same data must return the same result, Repeatable Read or Serializable may be warranted.

    D: Durability

    Durability means that once a transaction is committed, it stays committed even if the system crashes, loses power, or experiences a disk failure immediately after the commit.

    This is what write-ahead logging (WAL) provides in most databases. Before a transaction is committed, the changes are written to a log that survives crashes. If the system goes down, it replays the log on recovery and re-applies committed transactions.

    Durability is largely invisible when everything is working and critically important when it isn't. It's the reason you can trust a COMMIT statement to mean something real.

    ACID vs. BASE: A Practical Distinction

    When distributed NoSQL databases became popular, the term BASE emerged as a contrast to ACID:

  • Basically Available the system continues operating even under partial failures
  • Soft state data state may change over time without input
  • Eventually consistent the system will become consistent given enough time
  • Cassandra, DynamoDB, and CouchDB are examples of BASE-leaning databases. They trade strong consistency for higher availability and horizontal scalability. In a global distributed system, it can be physically impossible to guarantee ACID properties the CAP theorem formalises why.

    The practical question is: does your application need strong consistency guarantees, or can it tolerate brief periods where different nodes see different data? A social media feed can tolerate eventual consistency. A financial ledger cannot.

    Most relational databases PostgreSQL, MySQL, SQL Server, Oracle are ACID-compliant by default. Most multi-region NoSQL systems are not, though many offer tunable consistency options.

    Does ACID Matter for AI-Powered Database Tools?

    When you use a tool like AI for Database to query your database in plain English, the ACID properties of your underlying database are still doing their job. The AI layer generates and runs SQL against your database which means all the transactional guarantees of PostgreSQL, MySQL, or whatever you're using remain fully intact.

    This matters in practice: if you run an action workflow that triggers based on a database change (say, "send a Slack alert when a subscription payment fails"), that workflow is reading committed data from an ACID-compliant database. You're not reading uncommitted or stale states. The alerts fire on real, durable events.

    Similarly, if you build a dashboard in AI for Database that shows live revenue figures, you're querying the same committed transaction log as any other SQL query. The AI interface adds convenience; it doesn't change the data guarantees.

    When ACID Guarantees Break Down

    Even ACID databases have edge cases:

    Application-level logic outside transactions. If your application reads a row, does some calculation in code, then writes the result back and another transaction changes that row between your read and write you have a race condition. ACID doesn't save you from logic that runs outside a transaction. The fix is either to do all the logic inside a single transaction, or use database-level locking.

    Long-running transactions. A transaction that stays open for minutes or hours can block other transactions and accumulate lock contention. Keep transactions short and focused.

    Replication lag. In primary-replica setups, reads from replicas may return data that's slightly behind the primary even in an ACID database. If your application reads from a replica immediately after writing to the primary, you might not see your own write. This is a configuration and architecture concern, not an ACID violation.

    Savepoints and partial rollbacks. Most ACID databases support savepoints within a transaction partial rollback points. Used incorrectly, they can create confusing data states. Use them deliberately and document their intent.

    Wrapping Up

    ACID is not an advanced topic reserved for database administrators. Any developer who works with a database is implicitly relying on these properties every day. Understanding what they mean and where their limits are makes you better at designing reliable applications.

    If you're spending too much time writing queries against your ACID-compliant database, AI for Database connects to PostgreSQL, MySQL, and other databases and lets you ask questions in plain English. The underlying guarantees stay exactly the same you just skip the query-writing step.

    Ready to try AI for Database?

    Query your database in plain English. No SQL required. Start free today.