Skip to content

Instantly share code, notes, and snippets.

@dknecht
Created September 30, 2010 00:42
Show Gist options
  • Save dknecht/603826 to your computer and use it in GitHub Desktop.
Save dknecht/603826 to your computer and use it in GitHub Desktop.
SELECT COUNT(*) FROM "core_account" INNER JOIN "core_account_channels" ON ("core_account"."user_ptr_id" = "core_account_channels"."account_id") INNER JOIN "auth_user" ON ("core_account"."user_ptr_id" = "auth_user"."id") WHERE ("core_account_channels"."channel_id" = E'549eb2b42fd34d57a1aa0437d9a38dab' AND "auth_user"."date_joined" >= E'2010-09-29 00:00:00' AND "auth_user"."date_joined" <= E'2010-09-29 23:59:59' )
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Aggregate (cost=36305.99..36306.00 rows=1 width=0) (actual time=297.080..297.080 rows=1 loops=1)
-> Nested Loop (cost=19095.19..36305.69 rows=116 width=0) (actual time=182.738..296.900 rows=173 loops=1)
-> Hash Join (cost=19095.19..26204.95 rows=1489 width=8) (actual time=182.718..295.285 rows=173 loops=1)
Hash Cond: (core_account_channels.account_id = auth_user.id)
-> Bitmap Heap Scan on core_account_channels (cost=1905.82..8829.72 rows=45592 width=4) (actual time=13.333..73.306 rows=47222 loops=1)
Recheck Cond: ((channel_id)::text = '549eb2b42fd34d57a1aa0437d9a38dab'::text)
-> Bitmap Index Scan on core_account_channels_channel_id (cost=0.00..1894.42 rows=45592 width=0) (actual time=11.654..11.654 rows=47222 loops=1)
Index Cond: ((channel_id)::text = '549eb2b42fd34d57a1aa0437d9a38dab'::text)
-> Hash (cost=17170.76..17170.76 rows=1489 width=4) (actual time=169.130..169.130 rows=5383 loops=1)
-> Seq Scan on auth_user (cost=0.00..17170.76 rows=1489 width=4) (actual time=0.046..162.127 rows=5383 loops=1)
Filter: ((date_joined >= '2010-09-29 00:00:00+00'::timestamp with time zone) AND (date_joined <= '2010-09-29 23:59:59+00'::timestamp with time zone))
-> Index Scan using core_account_pkey on core_account (cost=0.00..6.77 rows=1 width=4) (actual time=0.004..0.005 rows=1 loops=173)
Index Cond: (core_account.user_ptr_id = core_account_channels.account_id)
Total runtime: 297.161 ms
(14 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment