Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider making default IsolationLevel REPEATABLE_READ #307

Open
AnyhowStep opened this issue May 6, 2020 · 3 comments
Open

Consider making default IsolationLevel REPEATABLE_READ #307

AnyhowStep opened this issue May 6, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@AnyhowStep
Copy link
Owner

Right now, the default with this library is SERIALIZABLE.

The problem here is that this causes deadlocks really easily.

How often do people really need SERIALIZABLE, vs the more relaxed REPEATABLE_READ?

@AnyhowStep AnyhowStep added the enhancement New feature or request label May 6, 2020
@AnyhowStep AnyhowStep self-assigned this May 6, 2020
@AnyhowStep
Copy link
Owner Author

AnyhowStep commented May 6, 2020

With REPEATABLE_READ, you can still have deadlocks and timeouts, but this should only happen with long-lived transactions.

And, usually, you shouldn't have long-lived transactions. They should be small and quick.


SERIALIZABLE transactions can give you deadlocks, even for very short transactions.


Changing the default is technically a major breaking change.

@AnyhowStep
Copy link
Owner Author

However, the SQL standard does say the default is SERIALIZABLE...

And MySQL uses REPEATABLE_READ, while PostgresQL uses READ_COMMITTED...

@AnyhowStep
Copy link
Owner Author

Maybe transactions in the library shouldn't have a default isolation level at all, and should force users to carefully think about the isolation level they want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant