Skip to content

The new BARC study is here

Download now

ACID Transactions: Properties, Examples, and Database Guarantees

Florian Wenzel
· · 12 mins read

ACID transactions are units of database work governed by four properties: atomicity, consistency, isolation, and durability.

This guide explains the four properties, illustrates commit and rollback with an analytical data load, and provides criteria for evaluating a database’s transaction guarantees.

What Are ACID Transactions?

An ACID transaction groups database operations into one logical unit with atomicity, consistency, isolation, and durability. That unit may contain a single SQL statement or several statements the application commits or rolls back together. Within that boundary, COMMIT confirms the transaction, while ROLLBACK discards the transaction’s uncommitted changes.

PropertyWhat it establishes
AtomicityThe transaction’s changes commit as one unit or leave no committed changes.
ConsistencyThe transaction preserves defined integrity rules through database enforcement and correct application logic.
IsolationThe database controls interactions between concurrent transactions according to its supported isolation guarantees.
DurabilityCommitted changes persist through failures covered by the database’s documented durability guarantees.

These properties apply within the transaction scope the database supports, which applications must verify. Several consecutive SQL statements don’t necessarily share one transaction, particularly when the connection uses autocommit.

Transaction guarantees, data model, storage format, and workload orientation describe different characteristics of a database system. Our guide to transactional vs relational databases explains how workload orientation differs from the underlying data model. ACID support alone doesn’t establish suitability for high volumes of short, concurrent operational transactions.

How the Four ACID Properties Work

Consider an illustrative load that inserts sales records and marks an existing batch as complete in a control table. The application requires both changes to commit together and checks the batch against its expected totals.

Atomicity: commit or roll back the whole transaction

Atomicity means the transaction commits all its changes together or commits none of them. If the illustrative load aborts, neither its sales inserts nor its completion marker remains committed.

A failed SQL statement doesn’t always abort the transaction; behavior depends on the database and configuration. Applications must detect errors and stop or roll back where required before committing the intended unit of work.

Consistency: preserve defined integrity rules

Consistency means a transaction preserves the rules that define a valid database state. For this load, each sales record must reference a batch that exists in the control table. An enforced foreign key can check that relationship if the database supports it.

Other requirements need application validation, such as checking whether the loaded totals match the source extract.

A transaction can commit an entire batch even when the batch contains incorrect business values. Reconciliation must still compare the loaded data with the source and the rules that define a valid result.

Dirk Beerbohm, Global Partner Solution Architect, Exasol

Isolation: control interactions between concurrent transactions

Isolation governs how concurrent transactions interact and which changes they can observe during execution. For the illustrative load, a report may need a consistent view of sales records and batch status. The isolation level and the reader’s transaction boundaries determine which database states that report can observe.

Serializable isolation requires concurrent transactions to produce results equivalent to some serial execution of those transactions. The engine can still execute transactions concurrently while using coordination or conflict detection to preserve that guarantee. Other isolation levels may permit outcomes that serializable execution would prevent, so verify the engine’s documented behavior.

Durability: retain committed changes after failure

Durability means a successful commit preserves the transaction’s changes through failures covered by the system’s documented guarantees. For the illustrative load, recovery after a covered failure must retain the committed sales records and completion marker.

Verify whether those guarantees cover process crashes, power loss, or storage failures under the chosen deployment and configuration. Backup, disaster recovery, and availability require separate evaluation because durable commits alone don’t establish those protections.

ACID Transaction Example: An Analytical Data Load

This illustrative example groups sales inserts and a batch-status update within one transaction in the Exasol database. It follows documented transaction management in Exasol and uses EXAplus to control autocommit and error handling. The outcomes below are expected results; run this example in a test environment and verify the results.

Try Exasol Personal for Free

Run real workloads at full Exasol performance.

Define the transaction boundary and integrity rules

The transaction must insert the batch’s sales records and update its completion status together. Primary keys identify batches and sales records, while a foreign key requires each sale to reference an existing batch.

The application must also validate record counts and totals before committing the completed batch. Those business checks remain application responsibilities; the keys alone can’t establish that the source data was loaded correctly.

Use a new schema with sufficient privileges and no concurrent writers for this controlled example. Configure the EXAplus session before creating the tables, keeping these client commands separate from database SQL:

SET AUTOCOMMIT OFF;
WHENEVER SQLERROR EXIT 1 ROLLBACK;

The first command disables automatic commits; the second configures EXAplus to exit and roll back after a SQL error. Other database clients require their own equivalent connection and error-handling settings.

Create the tables, explicitly enable their key constraints, and commit the initial batch record:

CREATE SCHEMA acid_demo;

CREATE TABLE acid_demo.batch_control (
    batch_id DECIMAL(18, 0) NOT NULL,
    status VARCHAR(12) NOT NULL,
    CONSTRAINT pk_batch PRIMARY KEY (batch_id)
);

ALTER TABLE acid_demo.batch_control
    MODIFY CONSTRAINT pk_batch ENABLE;

CREATE TABLE acid_demo.sales_fact (
    sale_id DECIMAL(18, 0) NOT NULL,
    batch_id DECIMAL(18, 0) NOT NULL,
    amount DECIMAL(12, 2) NOT NULL,
    CONSTRAINT pk_sale PRIMARY KEY (sale_id),
    CONSTRAINT fk_sales_batch FOREIGN KEY (batch_id)
        REFERENCES acid_demo.batch_control (batch_id)
);

ALTER TABLE acid_demo.sales_fact
    MODIFY CONSTRAINT pk_sale ENABLE;

ALTER TABLE acid_demo.sales_fact
    MODIFY CONSTRAINT fk_sales_batch ENABLE;

INSERT INTO acid_demo.batch_control (batch_id, status)
VALUES (101, 'PENDING');

COMMIT;

This setup establishes a committed starting point with one pending batch and no sales records. The following transaction changes that state without including the schema setup in the same unit of work.

Compare a successful commit with a deliberate rollback

Starting from the committed setup, run these changes in the same EXAplus connection:

INSERT INTO acid_demo.sales_fact (sale_id, batch_id, amount)
VALUES
    (1, 101, 100.00),
    (2, 101, 150.00);

UPDATE acid_demo.batch_control
SET status = 'COMPLETE'
WHERE batch_id = 101;

Check the pending changes with this query before choosing either transaction outcome below:

SELECT
    b.batch_id,
    b.status,
    COUNT(s.sale_id) AS loaded_rows,
    COALESCE(SUM(s.amount), 0) AS loaded_amount
FROM acid_demo.batch_control b
LEFT JOIN acid_demo.sales_fact s
    ON s.batch_id = b.batch_id
WHERE b.batch_id = 101
GROUP BY b.batch_id, b.status;

Within the transaction, the expected result is COMPLETE, with two sales records totaling 250.00. The connection can read its own uncommitted changes; this result doesn’t establish what another connection can observe.

To discard the load deliberately, issue ROLLBACK and rerun the same verification query:

ROLLBACK;

The expected state returns to PENDING, with no sales records and a loaded amount of zero. The batch-control record remains because the setup committed it before the load transaction began.

To examine the commit path, repeat the insert and update statements after the rollback. Rerun the verification query and confirm that the batch matches the expected record count and total. Commit only if those checks pass and the status update affected exactly one row:

COMMIT;

Rerun the verification query and compare the expected states below, assuming no other sessions modify these tables.

CheckpointExpected batch statusExpected sales recordsExpected loaded amount
After committed setupPENDING00.00
After inserts and update, before either outcomeCOMPLETE, uncommitted2250.00
After ROLLBACKPENDING00.00
After repeating the changes and issuing COMMITCOMPLETE2250.00

These are expected outcomes derived from the transaction semantics, rather than recorded execution results. The comparison illustrates transaction boundaries and commit/rollback behavior; concurrent-reader behavior and crash recovery require separate tests.

How to Evaluate a Database’s ACID Guarantees

Evaluate ACID support against the operations, concurrency, and failure scenarios your application must handle. Record the documented guarantees and configuration first, then test whether the implementation meets those requirements.

Establish what the transaction covers

Identify every change that must commit together, including related tables, metadata updates, and control records. Confirm that the selected engine supports that transaction boundary for the relevant objects and operations. For the sales-load example, the inserts and completion marker must belong to the same transaction.

External file writes, notifications, and operations in other systems require their own coordination or recovery design. A database rollback can’t independently reverse an external action that falls outside its transaction boundary. An outbox pattern can coordinate database changes with subsequent event publication.

The term columnar database describes storage orientation; it doesn’t specify multi-table or distributed transaction support. Check transaction documentation for the deployment, table types, and interfaces the application will actually use.

Check isolation and concurrent-write behavior

Record the supported isolation levels, default behavior, and settings that change read or write guarantees. Decide whether reports need one consistent view across several queries or can accept newer committed data between statements. Test readers and writers using the transaction boundaries the application will use in production.

Exasol documents serializable isolation and locking at database-object granularity, such as a table. Its documentation states that two transactions can’t simultaneously update different rows of the same table. Evaluate waiting and conflicts under representative workloads before drawing conclusions about throughput or response time.

Define which errors permit retry and whether the application must repeat the entire transaction. Check how the driver reports conflicts and how the application prevents retries from repeating external actions.

Verify configuration, constraints, and failure assumptions

Verify autocommit settings before relying on several statements to form one transaction boundary. Exasol documents autocommit as enabled by default in its drivers, so configure the chosen interface explicitly. For EXAplus scripts, configure error handling to stop or roll back when SQL execution fails.

Inspect constraint states before relying on declared keys to protect relationships or prevent duplicate identifiers. Exasol supports enabled constraints for checking integrity rules, while disabled key constraints retain metadata without enforcement. Application validation must still cover requirements such as source totals, completeness, and permitted workflow transitions.

Document the failures covered by the durability guarantee and the recovery behavior expected after each one. Evaluate backup restoration and availability separately; a successful commit or rollback demonstration doesn’t establish either capability.

Use the following checklist to make evaluation criteria explicit before running tests against representative workloads.

RequirementEvidence to recordTest to perform
Related changes commit togetherSupported transaction scope, object types, and client settingsCompare commit and rollback outcomes across every participating table
Reports observe acceptable data statesIsolation guarantees and reader transaction boundariesRun reporting queries while another session changes related data
Conflicts receive appropriate handlingLock granularity, reported errors, and retry rulesIntroduce conflicting writes and inspect application responses
Integrity rules are enforcedEnabled constraints and application validation rulesAttempt invalid references, duplicate identifiers, and inconsistent batch totals
Committed data survives covered failuresPersistence configuration and documented recovery guaranteesVerify recovery after relevant failures in a controlled test environment
Performance meets workload requirementsTransaction mix, concurrency, data volume, and latency targetsMeasure the complete workload under expected operating conditions

The OLTP vs OLAP comparison explains how operational and analytical workloads place different demands on database engines. An ACID label supplies no benchmark for write throughput, response time, or contention under concurrent demand.

ACID vs BASE: Consistency and Availability

ACID describes transaction guarantees, while BASE describes an approach to availability and eventual consistency in distributed systems. BASE stands for basically available, soft state, and eventually consistent, emphasizing continued service despite temporary inconsistencies.

Basically available emphasizes keeping supported operations accessible during some failures, without requiring every component to remain available. Soft state allows state to change through background propagation or reconciliation, even without another client update. Eventual consistency requires replicas to converge when updates stop and the system can propagate and reconcile outstanding changes.

The word consistency has different meanings in these discussions, which makes a simple ACID-versus-BASE classification misleading. ACID consistency concerns preserving defined integrity rules. In the consistency, availability, and partition tolerance (CAP) theorem, consistency means linearizability: operations appear to act on one logical copy of the data in an order consistent with real time.

Evaluation questionACID perspectiveBASE perspective
What must remain correct?Changes within a transaction preserve defined rules and commit atomicallyTemporarily different states may be acceptable while updates propagate and reconciliation completes
What can a reader observe?Visibility depends on the documented isolation guarantees and transaction boundariesA reader may receive an older value before updates converge
What must the application handle?Transaction boundaries, business validation, errors, and retriesStale observations, delayed updates, and any required conflict resolution
What needs separate verification?Replication freshness, availability, and the scope of failure protectionAvailability conditions, convergence behavior, and any limits on propagation delay

These perspectives don’t define complete or mutually exclusive categories for every database product. An architecture can use ACID transactions for local changes and asynchronous replication or messaging between systems. That combination requires separate checks for transaction integrity, read freshness, and failure handling.

SQL and NoSQL labels alone don’t establish a deployment’s transaction or replication guarantees. Evaluate the supported operations, transaction scope, replication behavior, and configuration for each workflow.

In the sales-load example, the sales inserts and completion marker need a shared transaction boundary. A downstream dashboard cache might tolerate delayed refresh if its users understand the freshness limits. Choose guarantees per workflow, based on the consequences of partial changes, stale reads, and delayed reconciliation.

Frequently Asked Questions

An ACID transaction is a unit of database work governed by atomicity, consistency, isolation, and durability. Its changes commit together or roll back, preserve defined integrity rules, and follow the database’s isolation guarantees. Committed changes persist through failures covered by the system’s documented durability guarantees.

In Databricks, ACID transactions let supported operations commit together while preserving documented consistency, isolation, and durability guarantees. Delta Lake uses a transaction log to record committed table versions and coordinate changes. Multi-statement transactions can span supported Unity Catalog managed Delta Lake or Iceberg tables with catalog commits enabled. Supported compute and runtime requirements also apply, so transaction scope depends on the deployment.

No. ACID describes transaction guarantees independently of the query language used to access a database. Both relational and non-relational systems can support ACID transactions, subject to their implementation, configuration, and supported transaction scope.

Yes, MongoDB supports multi-document ACID transactions on replica sets and sharded clusters, subject to deployment requirements. Single-document writes are atomic without a multi-document transaction, while grouped changes across documents require transactions for group atomicity. Read and write concern settings affect the guarantees; standalone deployments don’t support multi-document transactions.

Florian Wenzel
Florian Wenzel

As VP of Product Management at Exasol, Florian Wenzel is dedicated to developing products that customers love. His key responsibilities include aligning direct customer needs with innovative features to create impactful and strategic product roadmaps. Florian brings a wealth of experience to his role, having previously served as the Global Head of Solution Engineering. This position honed his deep understanding of diverse use cases and equipped him with extensive expertise in database technologies—an area he has thoroughly explored during his PhD studies. With a strong foundation in customer-focused product development and technical proficiency, Florian continues to drive Exasol’s mission to deliver outstanding database solutions.