start transaction – start a transaction
start transaction transaction-mode [ , ... ] ; where transaction-mode is one of: isolation serializable read write | read only deferrable | not deferrable
This command starts a new transaction block.
Any EdgeDB command outside of an explicit transaction block starts an implicit transaction block; the transaction is then automatically committed if the command was executed successfully, or automatically rollbacked if there was an error. This behavior is often called “autocommit”.
The transaction-mode can be one of the following:
All statements of the current transaction can only see data changes committed before the first query or data-modification statement was executed in this transaction. If a pattern of reads and writes among concurrent serializable transactions would create a situation which could not have occurred for any serial (one-at-a-time) execution of those transactions, one of them will be rolled back with a serialization_failure error.
Sets the transaction access mode to read/write.
This is the default.
Sets the transaction access mode to read-only. Any data
delete are disallowed. Schema mutations via DDL are also disallowed.
The transaction can be set to deferrable mode only when it is
read only. When all three of these
properties are selected for a transaction, the transaction
may block when first acquiring its snapshot, after which it is
able to run without the normal overhead of a
transaction and without any risk of contributing to or being
canceled by a serialization failure. This mode is well suited
for long-running reports or backups.
Start a new transaction and rollback it:
start transaction; select 'Hello World!'; rollback;
Start a serializable deferrable transaction:
start transaction isolation serializable, read only, deferrable;