Created
December 21, 2019 18:01
-
-
Save rueian/2e2afd5004eaf03736b5e6c6c3f6dd1a to your computer and use it in GitHub Desktop.
HashAggregate.4.sql
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
postgres=# | |
EXPLAIN WITH subscribers AS (SELECT user_id FROM playlist_subscriptions WHERE list_id = 3343594) | |
SELECT * FROM devices WHERE user_id IN (SELECT user_id FROM subscribers); | |
QUERY PLAN | |
----------------------------------------------------------------------------------------------------------------------------- | |
Hash Join (cost=32995.28..241867.55 rows=294585 width=170) | |
Hash Cond: (devices.user_id = playlist_subscriptions.user_id) | |
-> Seq Scan on devices (cost=0.00..194390.62 rows=5516762 width=170) | |
-> Hash (cost=32705.43..32705.43 rows=23188 width=8) | |
-> Bitmap Heap Scan on playlist_subscriptions (cost=1350.13..32705.43 rows=23188 width=8) | |
Recheck Cond: (list_id = 3343594) | |
-> Bitmap Index Scan on playlist_subscriptions_list_id_user_id_uniq (cost=0.00..1344.34 rows=23188 width=0) | |
Index Cond: (list_id = 3343594) | |
(8 rows) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment