Last active
August 29, 2015 14:15
-
-
Save taddeimania/1d72787a68e88a3209ef to your computer and use it in GitHub Desktop.
Why for the other fast?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select mt.id from massive_table mt | |
where not exists | |
(select id from big_table bt where bt.massive_table_id=mt.id); | |
select mt.id from massive_table mt | |
left join big_table bt on bt.massive_table_id = mt.id | |
where bt.massive_table_id is null; | |
-- The left join query appears to return results 100x faster. | |
-- Is the 2nd query that much more efficient than the 1st query or | |
-- is MySQL just caching the query better? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍 you rock spencer