explain.depesz.com

PostgreSQL's explain analyze made readable

Result: OEwn

Settings
# exclusive inclusive rows x rows loops node
1. 4,092.201 7,615.337 ↑ 66.9 532 1

HashAggregate (cost=13,639.61..13,746.42 rows=35,603 width=12) (actual time=7,615.152..7,615.337 rows=532 loops=1)

  • Group Key: users.id
2. 2,857.945 3,523.136 ↓ 653.9 23,281,923 1

Hash Left Join (cost=10,242.09..13,604.01 rows=35,603 width=4) (actual time=178.299..3,523.136 rows=23,281,923 loops=1)

  • Hash Cond: (user_list_users.user_id = user_activities.user_id)
3. 30.511 489.783 ↓ 47.0 112,258 1

Nested Loop (cost=0.29..2,915.55 rows=2,386 width=8) (actual time=0.165..489.783 rows=112,258 loops=1)

  • Join Filter: (user_list_users.user_id = user_campaigns.user_id)
4. 10.091 342.294 ↓ 43.0 58,489 1

Nested Loop (cost=0.23..2,821.13 rows=1,359 width=12) (actual time=0.115..342.294 rows=58,489 loops=1)

  • Join Filter: (user_list_users.user_id = contacts.contactable_id)
5. 0.198 4.843 ↓ 13.5 1,056 1

Nested Loop (cost=0.12..215.91 rows=78 width=8) (actual time=0.034..4.843 rows=1,056 loops=1)

6. 0.421 0.421 ↓ 13.5 1,056 1

Index Scan using index_user_list_users_on_user_list_id on user_list_users (cost=0.06..4.80 rows=78 width=4) (actual time=0.014..0.421 rows=1,056 loops=1)

  • Index Cond: (user_list_id = 136)
7. 4.224 4.224 ↑ 1.0 1 1,056

Index Only Scan using users_pkey on users (cost=0.06..2.70 rows=1 width=4) (actual time=0.003..0.004 rows=1 loops=1,056)

  • Index Cond: (id = user_list_users.user_id)
  • Heap Fetches: 745
8. 327.360 327.360 ↓ 1.4 55 1,056

Index Scan using contact_phone_index on contacts (cost=0.11..33.26 rows=39 width=4) (actual time=0.023..0.310 rows=55 loops=1,056)

  • Index Cond: ((contactable_id = users.id) AND ((contactable_type)::text = 'User'::text))
  • Filter: ((state_abbrev)::text = 'CA'::text)
  • Rows Removed by Filter: 282
9. 116.978 116.978 ↓ 2.0 2 58,489

Index Only Scan using index_user_campaigns_on_user_id on user_campaigns (cost=0.06..0.07 rows=1 width=4) (actual time=0.001..0.002 rows=2 loops=58,489)

  • Index Cond: (user_id = contacts.contactable_id)
  • Heap Fetches: 112211
10. 80.720 175.408 ↓ 1.0 473,685 1

Hash (cost=8,585.60..8,585.60 rows=473,201 width=4) (actual time=175.408..175.408 rows=473,685 loops=1)

  • Buckets: 524288 Batches: 1 Memory Usage: 20749kB
11. 94.688 94.688 ↓ 1.0 473,685 1

Seq Scan on user_activities (cost=0.00..8,585.60 rows=473,201 width=4) (actual time=0.007..94.688 rows=473,685 loops=1)

Planning time : 2.145 ms
Execution time : 7,615.682 ms