Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it good practice to leave MySQL's "auto commit" mode disabled across a web application?

Regarding MySQL and InnoDB tables, is it considered good practice to globally keep the autocommit mode disabled, so that all SQL statements throughout your code have to be explicitly committed? Does this introduce any overhead or other adverse conditions?

like image 263
reformed Avatar asked Mar 07 '23 11:03

reformed


1 Answers

My experience is better to enable it by default if your framework supports it. If you forget to commit, the uncommitted transaction may lock a lot of resources.

like image 73
Sherry Avatar answered Mar 10 '23 01:03

Sherry