Atomicity makes a transaction all-or-nothing: every operation succeeds as one unit, or the transaction has no effect. For system commands, this prevents partial changes when a command fails. section 9.1.1
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
A product lookup, credit deduction, and order insertion are grouped between transaction boundaries, so the command’s operations succeed or fail together. section 9.1.1
Choose the transaction boundary according to where the command’s work occurs:
- For operations local to one service, use a local ACID transaction to provide atomicity. section 9.4
- For operations spanning services, use a saga of local transactions; the saga itself is not ACID, and compensating transactions may undo prior steps. section 9.4


















