Tag Info

Hot answers tagged


According to the documentation, AUTOCOMMIT should be turned off in InnoDB. When importing data into InnoDB, turn off autocommit mode, because it performs a log flush to disk for every insert. When doing bulk inserts into tables with auto-increment columns, set innodb_autoinc_lock_mode to 2 instead of the default value 1


From the Connection.setAutoCommit docs: NOTE: If this method is called during a transaction and the auto-commit mode is changed, the transaction is committed. If setAutoCommit is called and the auto-commit mode is not changed, the call is a no-op. But I don't think it's very readable/obvious in your code. You should probably simply commit before ...


The commit is scoped to the session. When autocommit is turned off, the transactions are rolled back when you close the session. But you should see the consequences way before you stop MySQL, unless you keep your sessions running for weeks...? By the way, the autocommit variable is dynamic you can turn on/off when you want for the next sessions. SET GLOBAL ...


You have a trade-off you need to be aware of. Granted, it is true that a log flush happens with each INSERT involved with autocommit=1. Nevertheless, are there any consequences of setting autocommit=0 ? Think about the redo logs (ib_logfile0,ib_logfile1) and the undo tablespace (inside ibdata1). Change information must be stored somewhere in case the ...

Only top voted, non community-wiki answers of a minimum length are eligible