explain.depesz.com

PostgreSQL's explain analyze made readable

Result: tRzA

Settings
# exclusive inclusive rows x rows loops node
1. 1,588.616 5,056.517 ↑ 1.0 1 1

Aggregate (cost=13,621.81..13,621.82 rows=1 width=8) (actual time=5,056.517..5,056.517 rows=1 loops=1)

2. 2,858.179 3,467.901 ↓ 653.9 23,281,923 1

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

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

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

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

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

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

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

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

  • Index Cond: (user_list_id = 136)
7. 2.112 2.112 ↑ 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.002..0.002 rows=1 loops=1,056)

  • Index Cond: (id = user_list_users.user_id)
  • Heap Fetches: 747
8. 280.896 280.896 ↓ 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.018..0.266 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. 87.067 169.011 ↓ 1.0 473,685 1

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

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

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

Planning time : 1.829 ms
Execution time : 5,056.723 ms