beginnerTransactions — ACID, COMMIT, ROLLBACK, SAVEPOINT

What is the difference between ROLLBACK and ROLLBACK TO SAVEPOINT?

ROLLBACK: undoes ALL changes made in the current transaction since BEGIN. Returns to pre-BEGIN state. Transaction is ended. ROLLBACK TO SAVEPOINT name: undoes changes only SINCE the savepoint was created. The transaction is NOT ended — it remains active and can continue with more statements. The savepoint itself remains (unless RELEASE SAVEPOINT is used). Use case: complex workflows where a sub-st

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to How does PostgreSQL ensure durability with WAL?← Back to all SQL questions