I have one question regarding transaction isolation level and locking in mysql.
I have one query keeps getting the lock timeout error:
java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
The queries basically try to delete records with a specific date_id. BTW, the date_id is indexed as well. But most of the times, there are no records match, i.e. it will delete nothing.
After some investigation, I found it may be caused by a culprit long-running query, which do a range select on the same table. However, what confused me is both transaction run at isolation level of "READ COMMITTED". So I have no clue why a lock is needed and why it could timeout (especially consider there is no matching record to delete)
Thank you in advance!