title: delete operation locks whole table in innodb
body: <p>I have an issue with table locking in InnoDB on delete operation.
  I have a table queue with for example one column and a lot of transactions which can insert rows into this queue or delete them.
  There isn't any two transactions working with the same rows at the same time. So, all row locks must be distinct.
  But sometimes when delete operation deletes the most part of rows in the table, InnoDB prefers to use table lock instead of row lock and that causes deadlocks.</p>
  
  <p>I can't reproduce this deadlock exactly, but I found that lock problem.
  i.e. I have table queue:id with values(1,3,4,5,6,7)</p>
  
  <p>Transaction 1:</p>
  
  <pre><code>insert into queue value(2);
  </code></pre>
  
  <p>Transaction 2:</p>
  
  <pre><code>delete from queue where id in (1,3,4,5,6,7); -- here the lock comes
  </code></pre>