DP-900Chapter 35 of 101Objective 2.1

ACID Properties in Relational Databases

This chapter covers ACID properties—Atomicity, Consistency, Isolation, Durability—which are fundamental to relational databases and are critical for ensuring data integrity during transactions. On the DP-900 exam, ACID properties appear in approximately 10-15% of questions, primarily in the context of comparing relational and non-relational databases and understanding transaction guarantees. Mastering ACID is essential for explaining why relational databases are chosen for applications requiring strict consistency, such as financial systems. This chapter provides a deep, exam-focused exploration of each property, including mechanisms, defaults, and common misconceptions.

25 min read
Intermediate
Updated May 31, 2026

ACID Properties: A Bank Transaction Analogy

Imagine you are transferring $100 from your savings account to your checking account at a bank. The bank's system must ensure that this operation is Atomic, Consistent, Isolated, and Durable.

Atomicity: The bank's software debits $100 from savings and credits $100 to checking. If the power fails after the debit but before the credit, the system must automatically roll back the debit, so no money disappears. This is like an 'all-or-nothing' rule: either both steps complete or neither does. The bank uses a transaction log to record the intended changes before applying them; if a crash occurs, the log tells the system to undo any partial changes.

Consistency: Before the transfer, the total of savings + checking is, say, $1000. After a successful transfer, the total is still $1000. The bank has rules (constraints) that the sum of all accounts must match the bank's total liabilities. Any transaction that would violate this rule (e.g., creating money from nothing) is rejected. The database enforces these rules via constraints like CHECK, UNIQUE, and foreign keys.

Isolation: While you are transferring, your spouse is also transferring $50 from savings to checking at the exact same time. Each transaction must appear to run as if it were the only one. The bank uses a locking mechanism: when your transaction debits savings, it locks that row so your spouse's transaction must wait until yours completes. This prevents both from reading the same balance and causing an overdraft. The standard isolation level in many databases is 'Read Committed', which ensures you only see committed data.

Durability: Once the bank confirms your transfer, the change must survive a system crash. The bank writes the completed transaction to a non-volatile log (the transaction log) before sending you the confirmation. If the server crashes immediately after, upon restart, the system replays the log to ensure the changes are permanently applied. This is typically achieved by flushing the log to disk before acknowledging the transaction.

In summary, ACID properties guarantee that database transactions are processed reliably, just like a trustworthy bank ensures your money is safe and accurate.

How It Actually Works

What Are ACID Properties and Why Do They Exist?

ACID is an acronym for Atomicity, Consistency, Isolation, and Durability. These properties are a set of guarantees that database management systems (DBMS) provide to ensure that transactions—logical units of work—are processed reliably. A transaction is a sequence of one or more operations (e.g., SQL statements) that should be treated as a single, indivisible unit. The need for ACID arises from real-world scenarios where multiple users concurrently access and modify data, and where system failures (crashes, power outages) can occur at any moment. Without ACID, databases could end up in inconsistent states, losing or corrupting data.

How ACID Works Internally: Step Through the Mechanism

Atomicity is implemented through a mechanism called 'write-ahead logging' (WAL) or 'undo logging'. Before any changes are written to the actual data pages, the DBMS writes a record of the intended changes to a transaction log on durable storage. If a transaction fails or the system crashes before completion, the DBMS uses the log to 'undo' any partial changes, restoring the database to its previous state. For example, in SQL Server, the transaction log records 'before' and 'after' images. If a transaction aborts, SQL Server uses the 'before' image to roll back changes. The default behavior is that every transaction is atomic unless explicitly broken into multiple transactions.

Consistency is enforced through database constraints, such as PRIMARY KEY, UNIQUE, FOREIGN KEY, CHECK, and NOT NULL. These constraints are defined in the database schema and are checked automatically at the end of each transaction. If a transaction would violate any constraint, the entire transaction is rolled back. Consistency also includes application-level rules, but the DBMS only guarantees that constraints are not violated. For example, if a CHECK constraint ensures a salary column is > 0, any transaction that tries to set a negative salary will fail. Importantly, the DBMS does not enforce business rules that are not expressed as constraints; those must be handled by application code.

Isolation controls how concurrent transactions interact. The SQL standard defines four isolation levels: Read Uncommitted, Read Committed, Repeatable Read, and Serializable. Each level prevents certain phenomena: dirty reads, non-repeatable reads, and phantom reads. The default isolation level in most relational databases (e.g., SQL Server, PostgreSQL) is Read Committed, which prevents dirty reads but allows non-repeatable reads and phantoms. Isolation is implemented using locks (shared, exclusive, update) or multiversion concurrency control (MVCC). MVCC, used by PostgreSQL and Oracle, creates snapshots of data so that readers never block writers and vice versa. For example, in PostgreSQL, when a transaction updates a row, it creates a new version of the row; other transactions see the old version until the update commits. This allows high concurrency without dirty reads.

Durability ensures that once a transaction commits, its changes persist even if the system crashes immediately after. The primary mechanism is writing the transaction log to non-volatile storage (disk) before acknowledging the commit. This is often called 'write-ahead logging' (WAL) or 'commit log'. The DBMS flushes the log buffer to disk using fsync or similar OS calls. The default is that every commit forces a log flush, which can impact performance. Some databases allow asynchronous commits (e.g., SQL Server's DELAYED_DURABILITY) that trade durability for speed, but the default is full durability. In Azure SQL Database, durability is always guaranteed at the storage level, as data is replicated to multiple nodes.

Key Components, Values, Defaults, and Timers

Transaction Log: Every database has a transaction log file. In SQL Server, the log is a separate file with .ldf extension. The log records every change. The default size is auto-growing, but it's best practice to set a fixed size to prevent fragmentation.

Isolation Levels: The default isolation level varies by DBMS:

- SQL Server: READ COMMITTED (with row versioning optionally enabled) - PostgreSQL: READ COMMITTED - MySQL (InnoDB): REPEATABLE READ - Oracle: READ COMMITTED (with MVCC) - Lock Timeouts: Most databases have a default lock timeout, e.g., SQL Server has @@LOCK_TIMEOUT defaulting to -1 (no timeout). However, applications can set a timeout to avoid indefinite waits. - Deadlock Detection: Databases automatically detect deadlocks and choose a victim transaction to abort. In SQL Server, deadlock detection occurs every 5 seconds by default, and the transaction with the least cost is rolled back. - Log Flush Interval: By default, SQL Server flushes the log at commit time. However, for bulk operations, you can use BULK_LOGGED recovery model to minimize logging.

Configuration and Verification Commands

To check the current isolation level in SQL Server:

DBCC USEROPTIONS;

Look for 'isolation level' in the output.

To set isolation level in SQL Server:

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

To view transaction log size in SQL Server:

DBCC SQLPERF(LOGSPACE);

To check if a database is using read committed snapshot isolation (RCSI):

SELECT name, is_read_committed_snapshot_on FROM sys.databases;

In PostgreSQL, to check current isolation level:

SHOW transaction_isolation;

To set isolation level:

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

How ACID Interacts with Related Technologies

ACID properties are central to relational databases but are often relaxed in NoSQL databases (e.g., MongoDB, Cassandra) to achieve higher scalability and availability. NoSQL databases typically offer 'eventual consistency' and may not support multi-document transactions. However, some NoSQL systems have added ACID support for single-document operations. In Azure, Cosmos DB offers multiple consistency levels, including strong consistency which provides ACID-like guarantees within a single partition. For DP-900, understand that relational databases are chosen when ACID is mandatory, while NoSQL is chosen when flexibility and scale are more important.

ACID also interacts with replication and backup. For example, in Always On Availability Groups, transactions are committed on the primary replica and then replicated to secondary replicas. Durability on the secondary depends on the synchronization mode (synchronous vs asynchronous). Synchronous commit ensures the secondary has the log written before acknowledging the primary, providing zero data loss but impacting performance.

Trap Patterns: Common Wrong Answers

Trap: Believing that 'Consistency' means the data is always correct from a business perspective. In reality, the DBMS only guarantees that constraints are not violated; business logic consistency is the application's responsibility.

Trap: Confusing 'Isolation' with 'Durability'. Isolation is about concurrency; durability is about persistence.

Trap: Thinking that 'Atomicity' means multiple statements within a transaction are executed all at once. Actually, they are executed sequentially but rolled back as a unit if any fails.

Trap: Assuming that the default isolation level in all relational databases is 'Read Committed'. While common, MySQL's default is 'Repeatable Read'.

Edge Cases and Exceptions the Exam Loves to Test

Read Uncommitted: Allows dirty reads; used for reporting where accuracy is not critical. The exam may ask which isolation level prevents dirty reads (Answer: Read Committed or higher).

Snapshot Isolation: An additional isolation level in SQL Server that uses row versioning to provide read consistency without blocking. It prevents dirty reads, non-repeatable reads, and phantom reads, but is not the default.

Distributed Transactions: ACID across multiple databases requires a two-phase commit (2PC) coordinator, like Microsoft Distributed Transaction Coordinator (MSDTC). The exam may test that ACID is harder to achieve in distributed systems.

Durability in Cloud: In Azure SQL Database, durability is automatically handled by the platform with built-in redundancy (local redundant storage, zone-redundant, geo-redundant). The exam may ask about the default backup retention (7 days for basic tier, 35 days for standard).

How to Eliminate Wrong Answers Using the Underlying Mechanism

When faced with a question about ACID, first identify which property is being described. For example, if the question talks about 'all-or-nothing', it's Atomicity. If it mentions 'concurrent transactions not interfering', it's Isolation. If it's about 'data surviving a crash', it's Durability. Then, recall the specific mechanism: Atomicity uses undo logs; Consistency uses constraints; Isolation uses locks or MVCC; Durability uses write-ahead logs. Use this to eliminate options that describe a different property or a mechanism that doesn't match. For instance, if an option says 'Atomicity is achieved by using foreign key constraints', that is wrong because foreign keys enforce Consistency, not Atomicity.

Walk-Through

1

Begin a Database Transaction

A transaction is initiated explicitly with `BEGIN TRANSACTION` (or `BEGIN TRAN` in SQL Server) or implicitly by executing a single SQL statement like `INSERT`, `UPDATE`, or `DELETE`. In implicit mode, each statement is its own transaction. The DBMS marks the start in the transaction log, recording the current state for potential rollback. For example, in SQL Server, the log sequence number (LSN) is noted. This step is crucial because it establishes a recovery point: if a failure occurs before the transaction completes, the system knows where to roll back to.

2

Execute Operations Within Transaction

The application performs one or more data manipulation operations (DML) such as INSERT, UPDATE, DELETE. Each operation is executed against the database, but changes are initially made in memory (buffer pool) and recorded in the transaction log as 'log records'. The log records contain enough information to undo or redo the operation. At this stage, changes are not yet visible to other transactions (depending on isolation level). For example, if you update a row, the old and new values are logged. The DBMS also acquires locks on the affected rows or pages to prevent conflicts. The isolation level determines the type and duration of locks.

3

Check Constraints and Rules

Before the transaction commits, the DBMS validates all integrity constraints defined on the tables being modified. This includes PRIMARY KEY, UNIQUE, FOREIGN KEY, CHECK, and NOT NULL constraints. For example, if a foreign key constraint requires that a department ID exists in the Departments table, the DBMS checks that the referenced value is present. If any constraint is violated, the entire transaction is rolled back immediately, and an error is returned. This step ensures Consistency. The DBMS may also check triggers and other rules. In SQL Server, constraint checking occurs at the time of statement execution, but deferred constraints (e.g., `WITH CHECK` option) are checked at commit.

4

Commit Transaction

If all operations succeed and constraints are satisfied, the application issues `COMMIT TRANSACTION`. The DBMS then performs the commit process: it writes a 'commit' log record to the transaction log, flushes the log buffer to durable storage (disk) using an `fsync` system call, and then releases all locks held by the transaction. Once the log is flushed, the changes are guaranteed to survive a crash. The DBMS then marks the transaction as committed in the log. In SQL Server, the commit record includes the LSN of the last log record. After commit, the changes are permanently applied and visible to other transactions.

5

Handle Rollback on Failure

If at any point an error occurs (e.g., constraint violation, deadlock victim, explicit `ROLLBACK`), the DBMS performs a rollback. It reads the transaction log records for the transaction and applies the 'undo' information to revert each change. For example, if an UPDATE set a column to a new value, the rollback restores the old value. The DBMS releases any locks held. The rollback process is also logged to ensure durability of the rollback itself. After rollback, the database is in the state it was before the transaction began, ensuring Atomicity. In SQL Server, rollback can be time-consuming for large transactions, as all changes must be undone.

What This Looks Like on the Job

Scenario 1: Financial Banking System

A bank processes millions of transactions daily, including fund transfers, bill payments, and account updates. ACID properties are non-negotiable. For example, when a customer transfers $500 from savings to checking, the system must debit savings and credit checking atomically. If the server crashes after the debit, the system must roll back the debit to prevent money loss. The bank uses a relational database like SQL Server with full ACID compliance. They set the isolation level to READ COMMITTED to prevent dirty reads while allowing reasonable concurrency. Durability is ensured by synchronous commit and geo-replication across data centers. In production, the transaction log is sized appropriately (e.g., 500 GB) to handle peak loads, and log backups are taken every 5 minutes to prevent log growth. Misconfiguration, such as setting the isolation level to READ UNCOMMITTED, could cause dirty reads and lead to incorrect balance displays, potentially causing customer disputes.

Scenario 2: E-Commerce Order Processing

An e-commerce platform handles order placement, inventory deduction, and payment processing. A single order transaction might involve updating the inventory table, inserting an order record, and charging the customer's credit card. ACID ensures that if the payment fails, the inventory is not deducted and the order is not created. The database uses SERIALIZABLE isolation to prevent phantom reads, ensuring that inventory counts remain accurate even under high concurrency. For example, two customers trying to buy the last item in stock: the second transaction will be blocked until the first completes, preventing overselling. In production, the database is tuned to minimize deadlocks by accessing tables in a consistent order. A common misconfiguration is using too low an isolation level (e.g., READ COMMITTED) which could allow non-repeatable reads, causing the inventory check to see an outdated count and potentially oversell. The system also uses distributed transactions (MSDTC) when involving separate databases for orders and payments.

Scenario 3: Healthcare Patient Records

A hospital's electronic health record (EHR) system requires strict consistency and durability. Patient data must never be lost or corrupted. When a doctor updates a patient's medication list, the transaction must be atomic: either all changes are saved or none. The database uses REPEATABLE READ isolation to ensure that during a transaction, subsequent reads of the same data return the same values, preventing lost updates. Durability is critical: after the doctor saves changes, they must persist even if the server crashes. The system uses write-ahead logging and regular backups. In production, the transaction log is stored on high-availability storage (e.g., Azure Premium SSD with geo-redundancy). Misconfiguration, such as disabling log flushing for performance (e.g., DELAYED_DURABILITY), could result in data loss on a crash, violating regulatory requirements. The system also implements row-level security to ensure that only authorized users can access certain data, but this is separate from ACID.

How DP-900 Actually Tests This

Exactly What DP-900 Tests on This Topic

DP-900 objective 2.1: 'Describe relational data' includes understanding ACID properties. The exam expects you to:

Identify the four ACID properties and their definitions.

Explain why ACID is important for relational databases.

Compare ACID compliance between relational and non-relational databases.

Recognize scenarios where ACID is required (e.g., financial transactions).

Know the default isolation level of common databases (especially SQL Server: READ COMMITTED).

The exam does not test deep internals like write-ahead logging or lock escalation. Focus on conceptual understanding and practical implications.

The 3-4 Most Common Wrong Answers and Why Candidates Choose Them

1. Wrong Answer: 'Consistency means the data is always correct according to business rules.' Why Chosen: Candidates confuse database consistency (constraint enforcement) with application-level consistency. The exam tests that consistency is about constraints, not business logic.

2. Wrong Answer: 'Isolation ensures that one transaction's changes are saved permanently.' Why Chosen: This confuses Isolation with Durability. Isolation is about concurrency; durability is about persistence.

3. Wrong Answer: 'Atomicity guarantees that each SQL statement within a transaction is executed instantly.' Why Chosen: Candidates think atomic means 'fast' or 'instantaneous'. Actually, atomic means 'all or nothing'.

4. Wrong Answer: 'Durability is achieved by using the transaction log to roll back changes.' Why Chosen: This confuses the mechanism for atomicity (rollback) with durability. Durability uses the log to redo changes after a crash, not to undo.

Specific Numbers, Values, and Terms That Appear on the Exam

Default isolation level: READ COMMITTED (for SQL Server, PostgreSQL, Oracle). Note: MySQL InnoDB default is REPEATABLE READ.

Transaction log: The file that records all changes for recovery.

ROLLBACK: Command to undo a transaction.

COMMIT: Command to make changes permanent.

Dirty read: Reading uncommitted data, prevented by READ COMMITTED.

Non-repeatable read: Same query returns different results within a transaction, prevented by REPEATABLE READ.

Phantom read: A new row appears in a result set within a transaction, prevented by SERIALIZABLE.

Edge Cases and Exceptions the Exam Loves to Test

NoSQL vs Relational: Questions may ask which type of database provides ACID guarantees. The answer is relational databases, but some NoSQL databases (e.g., Cosmos DB with strong consistency) offer ACID-like guarantees for single documents.

Distributed Transactions: The exam may test that ACID is harder to maintain across multiple databases, often requiring two-phase commit.

Read Uncommitted: This isolation level allows dirty reads and is used for reporting where accuracy is not critical. The exam may ask which isolation level prevents dirty reads.

Snapshot Isolation: Not tested deeply, but you should know it provides read consistency without blocking.

How to Eliminate Wrong Answers Using the Underlying Mechanism

When you see a question about ACID, first map the description to the correct property. For example: - 'All or nothing' → Atomicity. - 'Data must follow rules' → Consistency. - 'Concurrent transactions don't interfere' → Isolation. - 'Committed data survives crashes' → Durability.

Then, look for answers that confuse mechanisms: e.g., 'Durability is achieved by undoing changes' is wrong because undoing is for Atomicity. Also, watch for answers that mention 'business rules' for Consistency—that is too broad. The exam wants 'constraints' or 'integrity rules'.

Finally, remember that the default isolation level in SQL Server is READ COMMITTED, not SERIALIZABLE. If a question asks which isolation level prevents dirty reads, the correct answer is READ COMMITTED (or higher).

Key Takeaways

ACID stands for Atomicity, Consistency, Isolation, Durability.

Atomicity ensures a transaction is all-or-nothing; implemented via write-ahead logging.

Consistency ensures data satisfies all defined constraints; enforced by the DBMS at commit time.

Isolation controls concurrency; the default isolation level in SQL Server is READ COMMITTED.

Durability ensures committed changes survive crashes; achieved by flushing the transaction log to disk.

The four isolation levels are: READ UNCOMMITTED, READ COMMITTED, REPEATABLE READ, and SERIALIZABLE.

READ COMMITTED prevents dirty reads but allows non-repeatable reads and phantom reads.

SERIALIZABLE prevents dirty reads, non-repeatable reads, and phantom reads by placing range locks.

Relational databases provide full ACID; NoSQL databases often relax ACID for scalability.

On the DP-900 exam, know the definitions and be able to identify which property is described in a scenario.

Common wrong answers confuse Isolation with Durability, or Atomicity with Consistency.

Easy to Mix Up

These come up on the exam all the time. Here's how to tell them apart.

Relational Database (e.g., SQL Server)

Full ACID compliance across multiple tables and rows.

Uses schema with predefined tables, rows, and relationships.

Default isolation level is typically READ COMMITTED.

Supports complex joins and transactions.

Best for applications requiring strict consistency, like banking.

NoSQL Database (e.g., MongoDB)

ACID typically limited to single document operations; multi-document ACID is possible but with performance cost.

Schema-less or flexible schema; data stored as documents (JSON).

Default consistency is eventual consistency; strong consistency available but impacts performance.

Designed for horizontal scaling and high throughput.

Best for applications requiring high scalability and flexibility, like content management.

Watch Out for These

Mistake

ACID properties are only important for financial applications.

Correct

While financial applications are a classic example, ACID is important for any application that requires data integrity, such as e-commerce, healthcare, and inventory management. The exam tests that ACID is a general requirement for relational databases, not limited to finance.

Mistake

Consistency means the data is always accurate from a business perspective.

Correct

Consistency in ACID refers to database consistency: all data must satisfy defined constraints (e.g., primary keys, foreign keys, unique constraints). Business logic consistency is the application's responsibility. The DBMS does not enforce business rules unless they are expressed as constraints.

Mistake

Isolation and Durability are the same thing.

Correct

Isolation ensures that concurrent transactions do not interfere with each other, preventing phenomena like dirty reads. Durability ensures that once a transaction commits, its changes persist even after a system crash. They address different concerns: concurrency vs. persistence.

Mistake

Atomicity means that all operations in a transaction happen at the same instant.

Correct

Atomicity means that the transaction is indivisible: either all operations complete successfully or none take effect. Operations are executed sequentially, but if any fails, the entire transaction is rolled back. It does not imply simultaneity.

Mistake

All NoSQL databases completely lack ACID support.

Correct

Many NoSQL databases offer ACID guarantees at the document or record level, but not across multiple documents. For example, MongoDB supports multi-document ACID transactions since version 4.0, but with performance trade-offs. The exam expects you to know that relational databases provide full ACID across multiple tables, while NoSQL databases often relax ACID for scalability.

Do You Actually Know This?

Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.

Frequently Asked Questions

What does ACID stand for in databases?

ACID stands for Atomicity, Consistency, Isolation, and Durability. These are properties that guarantee reliable processing of database transactions. Atomicity ensures that a transaction is all-or-nothing; Consistency ensures data integrity via constraints; Isolation ensures concurrent transactions don't interfere; Durability ensures committed data persists after a crash.

What is the default isolation level in SQL Server?

The default isolation level in SQL Server is READ COMMITTED. This level prevents dirty reads (reading uncommitted data) but allows non-repeatable reads and phantom reads. You can change it using the SET TRANSACTION ISOLATION LEVEL statement. Note that MySQL InnoDB defaults to REPEATABLE READ.

How does a database ensure durability?

Durability is typically ensured by writing transaction log records to non-volatile storage (disk) before acknowledging a commit. This is called write-ahead logging (WAL). If a system crash occurs, the database can replay the log to recover committed transactions. In Azure SQL Database, durability is also provided by redundant storage (e.g., LRS, GRS).

What is the difference between atomicity and consistency?

Atomicity ensures that a transaction is treated as a single, indivisible unit: either all operations complete or none. Consistency ensures that a transaction brings the database from one valid state to another, respecting all defined constraints (e.g., primary keys, foreign keys). Atomicity is about failure handling; consistency is about data integrity rules.

Can NoSQL databases support ACID transactions?

Yes, some NoSQL databases support ACID transactions, but often at the single-document level. For example, MongoDB supports multi-document ACID transactions since version 4.0, but with performance trade-offs. However, NoSQL databases are typically designed for eventual consistency and horizontal scaling, so full ACID across multiple documents may not be the default.

Which isolation level prevents dirty reads?

READ COMMITTED and higher isolation levels (REPEATABLE READ, SERIALIZABLE) prevent dirty reads. READ UNCOMMITTED allows dirty reads. Dirty reads occur when a transaction reads data that has been modified by another uncommitted transaction, leading to inconsistencies.

What is a phantom read?

A phantom read occurs when a transaction re-executes a query and finds a set of rows that includes new rows inserted by another committed transaction. This phenomenon is prevented by the SERIALIZABLE isolation level, which places range locks to prevent inserts that would affect the query result. REPEATABLE READ prevents non-repeatable reads but not phantom reads.

Terms Worth Knowing

Ready to put this to the test?

You've just covered ACID Properties in Relational Databases — now see how well it sticks with free DP-900 practice questions. Full explanations included, no account needed.

Done with this chapter?