title: MySQL: SELECT millions of rows
body: <p>I have a dataset of about 32Million rows that I'm trying to export to provide some data for an analytics project.  </p>
  
  <p>Since my final data query will be large, I'm trying limit the number of rows I have to work with initially.  I'm doing this by running a create table on the main table (32Million) records with a   join on another table that's about 5k records.  I made indexes on the columns where the JOIN is taking place, but not on the other where conditions.  This query has been running for over 4 hours now.  </p>
  
  <p>What could I have done to speed this up and if there is something, would it be worth it to stop this query, do it, and start over?  The data set is static and I'm not worried about preserving anything or proper database design long-term.  I just need to get the data out and will discard the schema.</p>
  
  <p>A simplified version of the query is below</p>
  
  <pre><code>CREATE TABLE RELEVANT_ALERTS
  SELECT a.time, s.name,s.class, ...
  FROM alerts a, sig s
  WHERE a.IP &lt;&gt; 0  
  AND a.IP not between x and y
  AND s.class in ('c1','c2','c3')
  </code></pre>