Skip to main content
The COMMIT commits the current or, when using , clears the connection to allow new transactions to begin. When using , statements issued after are committed when is issued instead of COMMIT. However, you must still issue a COMMIT statement to clear the connection for the next transaction. For non-retryable transactions, if statements in the transaction , COMMIT is equivalent to ROLLBACK, which aborts the transaction and discards all updates made by its statements.

Synopsis

commit_transaction syntax diagram

Required privileges

No are required to commit a transaction. However, privileges are required for each statement within a transaction.

Aliases

In CockroachDB, END is an alias for the COMMIT statement.

Example

Commit a transaction

How you commit transactions depends on how your application handles .

Client-side retryable transactions

When using , statements are committed by . COMMIT itself only clears the connection for the next transaction.
This example assumes you’re using client-side retry handling.

Automatically retried transactions

If you are using transactions that CockroachDB will (i.e., all statements sent in a single batch), commit the transaction with COMMIT.

See also