Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions sql-statements/sql-statement-savepoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ RELEASE SAVEPOINT identifier

After the transaction is committed or rolled back, all savepoints in the transaction will be deleted.

## Synopsis

```ebnf+diagram
SavepointStmt ::=
"SAVEPOINT" Identifier

RollbackToStmt ::=
"ROLLBACK" "TO" "SAVEPOINT"? Identifier

ReleaseSavepointStmt ::=
"RELEASE" "SAVEPOINT" Identifier
```

## Examples

Create a table `t1`:
Expand Down Expand Up @@ -141,6 +154,8 @@ SELECT * FROM t1;

When `ROLLBACK TO SAVEPOINT` is used to roll back a transaction to a specified savepoint, MySQL releases the locks held only after the specified savepoint, while in TiDB pessimistic transaction, TiDB does not immediately release the locks held after the specified savepoint. Instead, TiDB releases all locks when the transaction is committed or rolled back.

TiDB does not support the MySQL syntax `ROLLBACK WORK TO SAVEPOINT ...`.

## See also

* [COMMIT](/sql-statements/sql-statement-commit.md)
Expand Down