FirebirdSQL logo
 Context VariablesSecurity 

Transaction Parameters

The main parameters of a transaction are:

  • data access mode (READ WRITE, READ ONLY)

  • lock resolution mode (WAIT, NO WAIT) with an optional LOCK TIMEOUT specification

  • isolation level (READ COMMITTED, SNAPSHOT, SNAPSHOT TABLE STABILITY).

    Note

    The READ UNCOMMITTED isolation level is a synonym for READ COMMITTED, and is provided only for syntax compatibility.It provides identical semantics as READ COMMITTED, and does not allow you to view uncommitted changes of other transactions.

  • a mechanism for reserving or releasing tables (the RESERVING clause)

Access Mode

The two database access modes for transactions are READ WRITE and READ ONLY.

  • If the access mode is READ WRITE, operations in the context of this transaction can be both read operations and data update operations.This is the default mode.

  • If the access mode is READ ONLY, only SELECT operations can be executed in the context of this transaction.Any attempt to change data in the context of such a transaction will result in database exceptions.However, this does not apply to global temporary tables (GTT), which are allowed to be changed in READ ONLY transactions, see Global Temporary Tables (GTT) in [fblangref50-ddl] for details.

Lock Resolution Mode

When several client processes work with the same database, locks may occur when one process makes uncommitted changes in a table row, or deletes a row, and another process tries to update or delete the same row.Such locks are called update conflicts.

Locks may occur in other situations when multiple transaction isolation levels are used.

The two lock resolution modes are WAIT and NO WAIT.

WAIT Mode

In the WAIT mode (the default mode), if a conflict occurs between two parallel processes executing concurrent data updates in the same database, a WAIT transaction will wait till the other transaction has finished — by committing (COMMIT) or rolling back (ROLLBACK).The client application with the WAIT transaction will be put on hold until the conflict is resolved.

If a LOCK TIMEOUT is specified for the WAIT transaction, waiting will continue only for the number of seconds specified in this clause.If the lock is unresolved at the end of the specified interval, the error message “Lock time-out on wait transaction” is returned to the client.

Lock resolution behaviour can vary a little, depending on the transaction isolation level.