Open daveroberts opened 2 weeks ago
Are you using this driver directly or via orm / query builder? This driver does not start transactions implicitly, maybe some other layer adds that?
Directly
We have millions of queries on this DB per day, but about once per day, we get a deadlock error with a query where we're not using locks. The query:
The error:
Deadlock found when trying to get lock; try restarting transaction
Our code uses no manually created transactions, but we're getting a transaction error, which leads me to believe the library is creating one on our behalf, and doing so incorrectly.
By default, autocommit mode is enabled in MySQL and each SQL statement forms a single transaction on its own.
It's normal to experience occasional deadlocks when you have multiple connections performing lots of updates targeting a single table. Your code should be written to detect these deadlock errors when they occur and re-run the statement.
We have millions of queries on this DB per day, but about once per day, we get a deadlock error with a query where we're not using locks. The query:
The error:
Deadlock found when trying to get lock; try restarting transaction
Our code uses no manually created transactions, but we're getting a transaction error, which leads me to believe the library is creating one on our behalf, and doing so incorrectly.