# Databases : PostgreSQL : Transactions ```sql START TRANSACTION | BEGIN; <statement1>; -- \ transaction ... -- / block COMMIT | ROLLBACK; ``` #### Savepoints Savepoints allow you to selectively discard parts of the transaction, while committing the rest. - You can define multiple named savepoints, rollback to one by name — and do so multiple times. - You can release a savepoint if you no longer need the ability to rollback to it. - Rolling back to or releasing a savepoint will release all late savepoints. ```sql BEGIN; ... SAVEPOINT foo; ... ROLLBACK TO foo; ... COMMIT; ``` This will commit statements between `BEGIN` .. `SAVEPOINT` and between `ROLLBACK TO` .. `COMMIT`.