Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default isolation level for transaction (@atomic) with Django and PostgreSQL

I was wondering what's the default isolation level when using Django with PostgreSQL database. Serializable Isolation? (https://www.postgresql.org/docs/9.1/static/transaction-iso.html#XACT-SERIALIZABLE)

There is a discussion about MySQL (Django transaction isolation level in mysql & postgresql) but despite its name is doesn't seem to discuss PostgreSQL

Thanks!

like image 939
Alex Vyushkov Avatar asked Feb 19 '17 18:02

Alex Vyushkov


People also ask

What is the default isolation level in PostgreSQL?

Read Committed is the default isolation level in PostgreSQL. When a transaction uses this isolation level, a SELECT query (without a FOR UPDATE/SHARE clause) sees only data committed before the query began; it never sees either uncommitted data or changes committed during query execution by concurrent transactions.

Which choice is the default transaction isolation level?

Transaction Isolation Levels The default isolation level is REPEATABLE READ . Other permitted values are READ COMMITTED , READ UNCOMMITTED , and SERIALIZABLE .

What is transaction atomic () in Django?

Atomicity is the defining property of database transactions. atomic allows us to create a block of code within which the atomicity on the database is guaranteed. If the block of code is successfully completed, the changes are committed to the database. If there is an exception, the changes are rolled back.

How do I change the isolation level in PostgreSQL?

To set the default transaction isolation level (as opposed to individual transaction), use SET SESSION CHARACTERISTICS and specify either READ COMMITTED or SERIALIZABLE. Issuing a SET TRANSACTION command from within a transaction can override this default setting.


Video Answer


1 Answers

From the docs:

Like PostgreSQL itself, Django defaults to the READ COMMITTED isolation level.

like image 95
Nick Barnes Avatar answered Nov 15 '22 07:11

Nick Barnes