title: Best way to delete millions of rows by ID
body: <p>I need to delete about 2 million rows from my PG database. I have a list of IDs that I need to delete. However, any way I try to do this is taking days.  </p>
  
  <p>I tried putting them in a table and doing it in batches of 100. 4 days later, this is still running with only 297268 rows deleted. (I had to select 100 id's from an ID table, delete where IN that list, delete from ids table the 100 I selected).</p>
  
  <p>I tried:</p>
  
  <pre><code>DELETE FROM tbl WHERE id IN (select * from ids)
  </code></pre>
  
  <p>That's taking forever, too. Hard to gauge how long, since I can't see it's progress till done, but the query was still running after 2 days.</p>
  
  <p>Just kind of looking for the most effective way to delete from a table when I know the specific ID's to delete, and there are millions of IDs.</p>