Recently I had a customer where every single query was running in a transaction, as well as even the simplest selects. Unfortunately, this is not unique and many connectors like Java love to do that.
In their case, the Java connector changed
autocommit=off for the connection itself at the
beginning, and as these were permanent connections they never or
almost never reconnected.
In the slow query log we could see after every select there was a commit. So why is this a problem?
Test Case
Like always, the best way to deal with a problem to test it. I have created two EC2 instances t3.xlarge with Ubuntu, one for application and one for the databases. I have used sysbench to run my tests.
I have created a table with 1 million records and was running simple primary key point selects against the database. I was using …
[Read more]