Created
October 15, 2015 04:15
-
-
Save arossouw/cd1bc8a36a6c898c8132 to your computer and use it in GitHub Desktop.
postgresql semi-join
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
select * | |
from country | |
where country.code in | |
(select code | |
from country | |
where population > 7*1000*1000) | |
and country.continent = 'Europe'; | |
QUERY PLAN | |
------------------------------------------------------------------------ | |
Hash Join (cost=8.56..17.08 rows=18 width=113) | |
Hash Cond: (country_1.code = country.code) | |
-> Seq Scan on country country_1 (cost=0.00..7.99 rows=93 width=4) | |
Filter: (population > 7000000) | |
-> Hash (cost=7.99..7.99 rows=46 width=113) | |
-> Seq Scan on country (cost=0.00..7.99 rows=46 width=113) | |
Filter: (continent = 'Europe'::text) | |
(7 rows) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment