Create partial rollback points inside a transaction.
Section: Transactions
Use savepoints
sql
sql
BEGIN;
SAVEPOINT before_optional_step;
UPDATE orders SET status = "archived" WHERE order_id = 10;
ROLLBACK TO SAVEPOINT before_optional_step;
COMMIT;Explanation
Savepoints let you recover from part of a transaction without aborting the whole unit of work.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Transactions