BEGIN initiates a , which either successfully executes all of the statements it contains or none at all.
When running under the default isolation level, your application should that can occur under .
Synopsis
Required privileges
No are required to initiate a transaction. However, privileges are required for each statement within a transaction.Aliases
In CockroachDB, the following are aliases for theBEGIN statement:
BEGIN TRANSACTIONSTART TRANSACTION
Parameters
Examples
Begin a transaction
Use default settings
Without modifying theBEGIN statement, the transaction uses SERIALIZABLE isolation and NORMAL priority.
This example assumes you’re using .
Change isolation level
You can set the transaction isolation level to or . If not specified, transactions use the value of the current session’s variable.Change priority
You can set a transaction’s priority toLOW or HIGH.
Use the AS OF SYSTEM TIME option
You can execute the transaction using the database contents “as of” a specified time in the past.
Begin a transaction with automatic retries
CockroachDB will all transactions that contain bothBEGIN and COMMIT in the same batch. Batching is controlled by your driver or client’s behavior, but means that CockroachDB receives all of the statements as a single unit, instead of a number of requests.
From the perspective of CockroachDB, a transaction sent as a batch looks like this:

