Here's two pretty simple mysql statements (that happen in this order). For some reason, the second transaction often deadlocks. Does anyone have any idea why?
$query = "
DELETE FROM queues
WHERE queuetype='autoresponder'
AND recipient={$subscriberid}
";
$this->Db->Query($query);
$query = "
INSERT INTO queues (queueid, queuetype, ownerid, recipient, processed)
SELECT queueid, 'autoresponder', ownerid, {$subscriberid}, 0
FROM autoresponders
WHERE listid={$listid}
AND active<>0
";
$status = $this->Db->Query($query);
Both tables have numerous indexes...
Does anyone have any idea why, when the two transactions are executed separately, the deadlock occurs on the second Query()?