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?
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')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With