Possible Duplicate:
Join vs. subquery
I need to work with a massive set of data, but need to on occasion exclude records based on a condition.
Since the amount of data being checked against, and also the amount of data that will be returned is in the tens of thousands at a time, and this will be run frequently, I was wondering if anybody could shed some light on which approach is best in terms of speed and load so keep things running as smoothly as we can
SELECT a.*
FROM table_a as a
LEFT JOIN table_b
ON table_b.a_id = a.id
WHERE table_b.status <> 'new'
OR
SELECT *
FROM table_a
WHERE id NOT IN (
SELECT a_id
FROM table_b
WHERE status <> 'new'
)