An ACID transaction groups operations into one unit of work: all changes take effect, or none do. It provides atomicity, consistency, isolation, and durability, defining a boundary for correctness, failure, and concurrent access. section 9.1.1 section 9.4
Choose the transaction approach according to service scope:
- For operations local to one service, use an ACID transaction. section 9.4
- For operations spanning services, use a saga of local ACID transactions. The saga itself lacks isolation, so it needs application-level safeguards; classic XA/2PC distributed transactions bring complexity and runtime coupling. section 9.2 section 9.4
BEGIN TRANSACTION
SELECT * FROM PRODUCTS WHERE PRODUCT_ID = ?
UPDATE CONSUMER
SET AVAILABLE_CREDIT = AVAILABLE_CREDIT - ?
WHERE CONSUMER_ID = ?
AND AVAILABLE_CREDIT >= ?
INSERT INTO ORDERS (...) VALUES (...)
COMMIT TRANSACTION
The transaction groups a product lookup, a credit update, and an order insert into one explicit unit of work. section 9.1.1









