title: MySQL: How to find rows locked by transaction
body: <p>Example:</p>
  
  <pre><code>START TRANSACTION;
  UPDATE books SET printedCount=1000 WHERE id=5;
  </code></pre>
  
  <p>How can I find which rows of table <code>books</code> are locked by opened transactions (or ids, primary keys of these rows)? I want to track this information to prevent deadlocks in my high-load web application, maybe to delay some update queries if rows which can be affected by these queries are already locked.</p>