Set default global postgres transaction isolation level

10

How can I change the default transaction isolation level for the database?

The postgres docs show how to change it per transaction and per session - but not how to alter the default for the database or cluster.

In MySQL the operation is

SET GLOBAL TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;

Is there an equivalent for PostgreSQL?

answered question

1 Answer

9

Per the contents of this book indexed by google

One can change the whole default database isolation level to SERIALIZABLE as follows

ALTER DATABASE <DATABASE NAME> SET DEFAULT_TRANSACTION_ISOLATION TO SERIALIZABLE ;

So for read committed, for example, one can do:

ALTER DATABASE <db name> SET DEFAULT_TRANSACTION_ISOLATION TO 'read committed';

and you can confirm this with

SELECT current_setting('transaction_isolation')

posted this

Have an answer?

JD

Please login first before posting an answer.