I have 500 independent insert queries. I put them in a transaction to run faster. I am runing queries with PHP.

What will happen if one of queries fails? Will the transaction be rolled back automaticaly or not?

Maybe this question has been asked before, but I cannot find an answer. If there is one, please share it with me.


1 Answer 1


Deadlock or lock wait timeout == implicit transaction rollback.

All another errors will rollback only the statement, not whole transaction.

See InnoDB Error Handling in the documentation.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.