Is there a performance difference in the following?
SELECT person.id
FROM person
LEFT JOIN address ON person.id = address.personID
WHERE address.personID IS NOT NULL
vs
SELECT person.id
FROM person
INNER JOIN address ON person.id = address.personID
This query should show all person ID's that have an address record (not all do). The logical thing to do here would be to use an Inner Join as the second example shows. For reasons that are not entirely important (the query is being generated from a query builder), I may have to use the first approach.
Curious what the impact is. Does MySQL do a lot of extra work when it LEFT JOIN's and then compares that field against null to reduce the set? Maybe that's how INNER JOIN works behind the scenes anyway?