Last active
October 18, 2019 09:37
-
-
Save ketanbhatt/9771b4caa5f9ef2fe6aaa32935e8cb17 to your computer and use it in GitHub Desktop.
Avoid Joins: Evaluate and Select Query
This file contains 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
WITH user_ids AS | |
(SELECT id | |
FROM user | |
WHERE account_id IN | |
(SELECT generate_series(1,1000))) | |
SELECT purchase.id | |
FROM purchase | |
WHERE user_id IN | |
(SELECT id | |
FROM user_ids); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment