title: mysqldump hangs
body: <p>I have 2 mysql tables where one has a foreign key in another table.  When mysqldump using where statement to selectively dump certain subsets, the second mysqldump goes into a preparing state and hangs forever.  how do I fix this?</p>
  
  <pre>
  mysqldump -u$username -p$password --quick --lock-all-tables --where=&quot;table1_id&lt;1000&quot; $db table1 &gt; $dump_dir/table1.sql                                                                                                 
  
  mysqldump -u$username -p$password --quick --lock-all-tables --where=&quot;table2_id in (select table2_id from table1 where table1_id&lt;1000)&quot; $db table2 &gt;$dump_dir/table2.sql
  </pre>