Parameter · Client Connection Defaults / Statement Behavior
transaction_deferrable
Whether to defer a read-only serializable transaction until it can be executed with no possible serialization failures.
- Default:
off - Type: bool
- Applies: Session (any user)
In plain words
Shows or sets whether the current transaction is deferrable. You normally set it with BEGIN ISOLATION LEVEL SERIALIZABLE READ ONLY DEFERRABLE. Such a transaction waits for a safe moment to start and then can never fail with a serialization error.
For DBAs and operators
At the start of each transaction it is initialized from default_transaction_deferrable. Changing it with SET is the same as SET TRANSACTION [NOT] DEFERRABLE and must happen before the first query of the transaction.
It only has an effect when the transaction is also SERIALIZABLE and READ ONLY. The backend then waits (wait event SafeSnapshot) until it can take a snapshot that no concurrent serializable writer can invalidate. After that it runs without SSI tracking: no predicate locks, no 40001 failures, and no extra overhead for other serializable transactions.
Best used for long reports and consistent exports on systems using serializable isolation (pg_dump --serializable-deferrable).
How to change it
Any user can change it for their session with SET.
See it in context
Related parameters
default_transaction_deferrable transaction_isolation transaction_read_only