Parameter · Client Connection Defaults / Statement Behavior
transaction_isolation
Sets the current transaction's isolation level.
- Default:
read committed - Type: enum
- Values: serializable · repeatable read · read committed · read uncommitted
- Applies: Session (any user)
In plain words
Shows the isolation level of the transaction you are in. You can change it, but only at the very start of the transaction, before any query has run. Normally you set it with BEGIN ISOLATION LEVEL ….
For DBAs and operators
Initialized from default_transaction_isolation at the start of each transaction. SET transaction_isolation = … is equivalent to SET TRANSACTION ISOLATION LEVEL …. Once the transaction has run a query (and therefore taken its snapshot), changing it fails:
ERROR: SET TRANSACTION ISOLATION LEVEL must be called before any query
Setting it outside a transaction block only affects the single-statement transaction of that SET itself, so it appears to "do nothing". To change the level for a whole session, set default_transaction_isolation. Check the current level with SHOW transaction_isolation; pg_stat_activity does not show it.
How to change it
Any user can change it for their session with SET.
See it in context
Related parameters
default_transaction_isolation transaction_read_only transaction_deferrable