title: populate a MySQL with a large series of rows quickly
body: <p>I have a MySQL Table that looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/3z5YF.png" alt="MySQL Table: status"></p>
  
  <p>The SQL to create the structure is:</p>
  
  <pre><code>CREATE TABLE `status` (
  `id` INT(11) NOT NULL,
  `responseCode` INT(3) NOT NULL DEFAULT '503',
  `lastUpdate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  </code></pre>
  
  <p>It stores a unique <code>id</code>, <code>responseCode</code>, and <code>lastUpdate</code>.  The <code>responseCode</code> is an HTTP Request response code: 404, 500, 503, 200, etc.</p>
  
  <p>I have a URL to correspond to each <code>id</code> for which I make an HTTP request and record in this table the time I made the request and the response received.</p>
  
  <p>The script makes this query against the <code>status</code> table:</p>
  
  <pre><code>SELECT id FROM status WHERE lastUpdate &lt; 'XXXX' OR 
  (responseCode != 200 AND responseCode != 404) 
  ORDER BY id DESC LIMIT 100
  </code></pre>
  
  <p>Where <code>XXXX</code> would be a date where I decide that anything older than that date needs to be refreshed regardless of the response code.  Further, I want to reattempt the HTTP request if I didn't get a <code>200</code> or <code>404</code> regardless of the last <code>lastUpdate</code> date.  I <code>LIMIT</code> to 100 because I only run 100 at a time, and then I have it sleep for a while and do another 100 later, and so on.</p>
  
  <p>Anyways, all that's fine, but what I want to do is populate the table ahead of time with say a series like this:</p>
  
  <pre><code>(1, 503, NOW()), (2, 503, NOW()), (3, 503, NOW()) ... (100000, 503, NOW())
  </code></pre>
  
  <p>Notice, only the ID is incrementing, but it may not necessarily start at 1 for my needs.  I want the table pre-populated like this, because then the query above can keep grabbing <code>id</code>'s for ones we need to reattempt, and I'd like to not have to ever insert anything more into the <code>status</code> table as the <code>id</code>'s are finite and will not change (but there are many of them).</p>
  
  <p>I tried using JAVA, (though PHP, C#, or whatever else is the same concept and doesn't matter to me which language I use here):</p>
  
  <pre><code>PreparedStatement st = conn.prepareStatement("INSERT INTO status VALUES (?,default,default)");
  
  for( int i = 1; i &lt;= 100000; i++ ) {
      st.setInt(1,i);
      st.addBatch();
  }
  
  System.out.println( "Running batch..." );
  st.executeBatch();
  System.out.println( "Batch done!" );
  </code></pre>
  
  <p>This starts the inserts, but the issue is that it takes an extraordinary amount of time to populate the table (I don't have an exact time, but it was running for hours).  So, my question boils down to: is there an easy and efficient way to populate a MySQL table with a mass amount of rows like this?</p>