Hi Tobias, Thanks for your reply. Unfortunately I couldn't see from the manual why I was getting the deadlock - transaction 2 already has a lock on the index it is waiting for. The difference seems to be 'insert intention' - I'm not sure what different types of exclusive lock there are and how they relate to each other. Is there any way I can get both types of lock in one go, in the first statement I execute? Thanks, David
Tobias Asplund <[EMAIL PROTECTED]> wrote: On Wed, 6 Oct 2004, David Edwards wrote: > I've got a deadlock problem using InnoDB tables (...) > Transaction 1: > START TRANSACTION; > DELETE FROM results WHERE id_job = 25920; > INSERT INTO results(result,id_job) VALUES (31.461937,25920); > COMMIT; > > Transaction 2: > START TRANSACTION; > DELETE FROM results WHERE id_job = 25919; > INSERT INTO results(result,id_job) VALUES (25.388607,25919),(22.650234,25919); > COMMIT; I think this manual page might explain what's happening: http://dev.mysql.com/doc/mysql/en/InnoDB_Next-key_locking.html -- Tobias Asplund Trainer and Consultant, Sweden MySQL AB http://www.mysql.com --------------------------------- ALL-NEW Yahoo! Messenger - all new features - even more fun!