What is default isolation level for transactions in Ruby on Rails for PostgreSQL or MySQL?
active_record/connection_adapters/abstract/database_statements.rb#L173
The documentation states:
# If your database supports setting the isolation level for a transaction, you can set
# it like so:
#
# Post.transaction(isolation: :serializable) do
# # ...
# end
And the code is:
def transaction(requires_new: nil, isolation: nil, joinable: true)
The default value, is nil
, which means whatever the default isolation level of the database you are using.
The default value for MySQL is :repeatable_read.
The default value for Postgress is :read_committed.
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