title: MySQL "in" statement
body: <p>This question is really just out of curiosity. Can someone shed some light onto why this query:</p>
  
  <pre><code>insert into c (
      select a.* from a,b
      where a.x=8 and y=1 and b.z=a.z and active &gt; '2010-01-07 00:00:00'
      group by a.z
  )
  </code></pre>
  
  <p>is a million times faster (or close enough) than the query below whenever there's quite a few records involved?</p>
  
  <pre><code>insert into c (
      select * from a
      where x=8 and y=1 and z in (
          select z from b where x=8 and active &gt; '2010-01-07 00:00:00' group by z
      )
  )
  </code></pre>
  
  <p>What I mean is that a query joining a table is so much faster than using IN, but why is this?</p>