In my production error logs I occasionally see:

SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction

I know which query is trying to access the database at that moment but is there a way to find out which query had the lock at that precise moment?

Edit
Report