Search code examples
postgresqltransactions

Postgres DB isolation set at transaction level


I am new to RDBMS transaction management, and while going through a few articles, a thought crossed my mind - is isolation level set at transaction level, or db/table level, or both?

In case isolation is set at transaction level (as per few examples I came across in the internet), does it revert to the default isolation level (if such a concept exists) when the transaction is complete?


Solution

  • The isolation level is a property of the transaction, so you can only set it at the transaction level. The default isolation level is governed by the parameter default_transaction_isolation, which defaults to READ COMMITTED. The isolation level of the previous transaction has no influence on that of the next transaction, unless you use COMMIT AND CHAIN.