Skip to main content
The SET TRANSACTION sets the transaction priority, access mode, and “as of” timestamp after you it but before executing the first statement that manipulates a database.

Synopsis

set_transaction syntax diagram

Required privileges

No are required to set the transaction priority. However, privileges are required for each statement within a transaction.

Parameters

CockroachDB now only supports SERIALIZABLE isolation, so transactions can no longer be meaningfully set to any other ISOLATION LEVEL. In previous versions of CockroachDB, you could set transactions to SNAPSHOT isolation, but that feature has been removed.

Examples

Set priority

Use the AS OF SYSTEM TIME option

You can execute the transaction using the database contents “as of” a specified time in the past.

Set the default transaction priority for a session

To set the default transaction priority for all transactions in a session, use the default_transaction_priority . For example:
Note that transaction_priority is a read-only that cannot be set directly.

See also