title: Performance between CREATE TEMP TABLE AS vs INSERT INTO SELECT
body: <p>I was wondering is there a performance difference between:</p>
  
  <pre><code>query 1: CREATE TEMPORARY TABLE temp_table1 AS SELECT * FROM lookup_table JOIN ...
  </code></pre>
  
  <p>then  </p>
  
  <pre><code>INSERT INTO dest_table SELECT * FROM temp_table1
  </code></pre>
  
  <p>vs</p>
  
  <pre><code>query 2: INSERT INTO dest_table SELECT * FROM lookup_table JOIN ... 
  </code></pre>
  
  <p>My concern was, the lookup_table is accessed very often by different users and when I run query 2, most of the users need to wait longer to be able to retrieve their result. What I was thinking was to write the data into a temporary table then write it to dest_table  afterwards . Im just not sure if writing into a temp table with give a difference performance compared to writing it directly to the destination table. Im using mysql 5.6.</p>
  
  <p>The reason why I need to write data from lookup_table to dest_table is because I need to create a report from it. Seeing how complex the query from lookup_table is makes it very difficult to create a report so I decided to move those data to a single table then just make a report from it.</p>