Recently we ran into a wall in one of my customers’ sites. They built an application that processed EDI documents. Each document, contained a list of transactions. Their application would launch a thread for each transaction in the document. On the surface this sounds good and the multi-threaded approach would speed up processing of a document.

InnoDB is the only built-in transactional storage engine and unfortunately has some limitations.

TX1 SET TRANSACTION ISOLATION LEVEL READ COMMITTED
TX2 SET TRANSACTION ISOLATION LEVEL READ COMMITTED
TX1 START TRANSACTION
TX2 START TRANSACTION
TX1 INSERT INTO child
TX2 INSERT INTO child (with same parent)
TX1 UPDATE parent
TX2 UPDATE parent (same parent row)
ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction

We solved this issue using a third party storage engine; solidDB.

Other storage engines available with MySQL