To avoid deadlock, you must then make sure that concurrent transactions don't update row in an order that could result in a deadlock. Each time you insert/update/or delete a row, a lock is acquired. There are numerous questions and answers about deadlocks. (Say, 3 retries on this particular error before giving up).ĭeadlock happen when two transactions wait on each other to acquire a lock. you can add this logic to your client code. WHERE datetime <= now() - INTERVAL 900 SECONDĪnother thing to keep in mind is that MySQL documentation suggest that in case of a deadlock the client should retry automatically. if you do (and I suspect you do), order their WHERE in (k1,k2.kn) in ascending order.įix your delete statement to work in ascending order: Make sure you have no other queries that lock access more than one key at a time except for the delete statement.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |