Deadlocks Caused By InnoDB Gap Lock: A REPLACE INTO Gotcha
Deadlocks in MySQL caused by REPLACE INTO statements. Replaced with INSERT ON DUPLICATE KEY UPDATE, solving the issue. Also learned that REPLACE INTO deletes existing records before inserting new ones, triggering delete cascades.