explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yjIf

Settings
# exclusive inclusive rows x rows loops node
1. 4,231.549 18,047.568 ↑ 66.9 532 1

HashAggregate (cost=3,501.07..3,607.88 rows=35,603 width=12) (actual time=18,047.395..18,047.568 rows=532 loops=1)

  • Group Key: users.id
2. 3,102.604 13,816.019 ↓ 653.9 23,281,923 1

Nested Loop (cost=0.37..3,465.46 rows=35,603 width=4) (actual time=0.117..13,816.019 rows=23,281,923 loops=1)

  • Join Filter: (user_list_users.user_id = user_activities.user_id)
3. 57.707 497.937 ↓ 47.0 112,258 1

Nested Loop (cost=0.29..2,911.55 rows=2,386 width=16) (actual time=0.102..497.937 rows=112,258 loops=1)

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

Nested Loop (cost=0.23..2,817.13 rows=1,359 width=12) (actual time=0.091..323.252 rows=58,489 loops=1)

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

Nested Loop (cost=0.12..211.91 rows=78 width=8) (actual time=0.022..3.995 rows=1,056 loops=1)

6. 0.474 0.474 ↓ 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.013..0.474 rows=1,056 loops=1)

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

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

  • Index Cond: (id = user_list_users.user_id)
  • Heap Fetches: 716
8. 307.296 307.296 ↓ 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.020..0.291 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.002..0.002 rows=2 loops=58,489)

  • Index Cond: (user_id = contacts.contactable_id)
  • Heap Fetches: 112211
10. 10,215.478 10,215.478 ↓ 12.9 207 112,258

Index Only Scan using index_user_activities_on_user_id_and_activity_id on user_activities (cost=0.08..0.18 rows=16 width=4) (actual time=0.004..0.091 rows=207 loops=112,258)

  • Index Cond: (user_id = contacts.contactable_id)
  • Heap Fetches: 21540234
Planning time : 2.688 ms
Execution time : 18,048.008 ms