A savepoint marks a point that the current transaction can roll back to. Instead of rolling all of its changes back, it can choose to roll back only some of them. For example, suppose you:
- start a transaction,
- insert 10 rows into a table,
- set a savepoint,
- insert another 5 rows,
- rollback to the savepoint,
- commit the transaction.
After doing this, the table will contain the first 10 rows you inserted. The other 5 rows will have been deleted by the rollback.
Setting a savepoint doesn't 'save' any data to the database. It doesn't make database changes visible to any other transaction. A savepoint is just a marker that the current transaction can roll back to.