No privileges are required to set the transaction priority. However, privileges are required for each statement within a transaction.
||If you do not want the transaction to run with
Transactions with higher priority are less likely to need to be retried.
For more information, see Transactions: Priorities.
The current priority is also exposed as the session variable
||Set the transaction access mode to
||Execute the transaction using the database contents "as of" a specified time in the past.
For more information, see AS OF SYSTEM TIME.
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.
> SET TRANSACTION PRIORITY HIGH;
> SAVEPOINT cockroach_restart;
> UPDATE products SET inventory = 0 WHERE sku = '8675309';
> INSERT INTO orders (customer, sku, status) VALUES (1001, '8675309', 'new');
> RELEASE SAVEPOINT cockroach_restart;
AS OF SYSTEM TIME option
You can execute the transaction using the database contents "as of" a specified time in the past.
> SET TRANSACTION AS OF SYSTEM TIME '2019-04-09 18:02:52.0+00:00';
> SELECT * FROM orders;
> SELECT * FROM products;