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