explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4AG4

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.003 85.060 ↓ 0.0 0 1

Nested Loop Anti Join (cost=3,261.47..212,593.16 rows=993 width=2,173) (actual time=85.060..85.060 rows=0 loops=1)

2. 0.877 84.677 ↑ 86.3 19 1

Nested Loop (cost=3,260.63..185,409.90 rows=1,640 width=2,173) (actual time=14.935..84.677 rows=19 loops=1)

3. 2.707 14.386 ↑ 1.9 3,018 1

HashAggregate (cost=3,260.34..3,317.71 rows=5,737 width=16) (actual time=13.387..14.386 rows=3,018 loops=1)

  • Group Key: s.activity_uid
4. 11.679 11.679 ↓ 1.0 7,738 1

Index Scan using idx_sections_start_time on sections s (cost=0.42..3,241.65 rows=7,474 width=16) (actual time=0.027..11.679 rows=7,738 loops=1)

  • Index Cond: (start_time > now())
  • Filter: (published_at IS NOT NULL)
  • Rows Removed by Filter: 611
5. 15.891 69.414 ↓ 0.0 0 3,018

Index Scan using activities_pkey on activities (cost=0.29..31.74 rows=1 width=2,173) (actual time=0.023..0.023 rows=0 loops=3,018)

  • Index Cond: (uid = s.activity_uid)
  • Filter: ((published_at IS NOT NULL) AND ((alternatives: SubPlan 1 or hashed SubPlan 2) OR (alternatives: SubPlan 3 or hashed SubPlan 4)))
  • Rows Removed by Filter: 1
6.          

SubPlan (forIndex Scan)

7. 0.000 50.724 ↓ 0.0 0 2,818

Bitmap Heap Scan on saved_activities sa (cost=10.66..14.67 rows=1 width=0) (actual time=0.018..0.018 rows=0 loops=2,818)

  • Recheck Cond: ((user_uid = 'f28b119e-971c-4b74-890b-e2b22115920a'::uuid) AND (activity_uid = activities.uid))
  • Filter: (deleted_at IS NULL)
  • Heap Blocks: exact=19
8. 2.818 50.724 ↓ 0.0 0 2,818

BitmapAnd (cost=10.66..10.66 rows=1 width=0) (actual time=0.018..0.018 rows=0 loops=2,818)

9. 5.636 5.636 ↑ 2.5 24 2,818

Bitmap Index Scan on saved_activities_user_uid_index (cost=0.00..4.88 rows=61 width=0) (actual time=0.002..0.002 rows=24 loops=2,818)

  • Index Cond: (user_uid = 'f28b119e-971c-4b74-890b-e2b22115920a'::uuid)
10. 42.270 42.270 ↓ 1.2 175 2,818

Bitmap Index Scan on saved_activities_activity_uid_index (cost=0.00..5.52 rows=146 width=0) (actual time=0.015..0.015 rows=175 loops=2,818)

  • Index Cond: (activity_uid = activities.uid)
11. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on saved_activities sa_1 (cost=4.90..244.05 rows=51 width=16) (never executed)

  • Recheck Cond: (user_uid = 'f28b119e-971c-4b74-890b-e2b22115920a'::uuid)
  • Filter: (deleted_at IS NULL)
12. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on saved_activities_user_uid_index (cost=0.00..4.88 rows=61 width=0) (never executed)

  • Index Cond: (user_uid = 'f28b119e-971c-4b74-890b-e2b22115920a'::uuid)
13. 0.000 2.799 ↓ 0.0 0 2,799

Bitmap Heap Scan on followed_users fu (cost=10.11..14.13 rows=1 width=0) (actual time=0.001..0.001 rows=0 loops=2,799)

  • Recheck Cond: ((follower_uid = 'f28b119e-971c-4b74-890b-e2b22115920a'::uuid) AND (followed_uid = activities.user_uid))
  • Filter: (deleted_at IS NULL)
14. 0.000 2.799 ↓ 0.0 0 2,799

BitmapAnd (cost=10.11..10.11 rows=1 width=0) (actual time=0.001..0.001 rows=0 loops=2,799)

15. 2.799 2.799 ↓ 0.0 0 2,799

Bitmap Index Scan on followed_users_follower_uid_index (cost=0.00..4.46 rows=6 width=0) (actual time=0.001..0.001 rows=0 loops=2,799)

  • Index Cond: (follower_uid = 'f28b119e-971c-4b74-890b-e2b22115920a'::uuid)
16. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on followed_users_followed_uid_index (cost=0.00..5.39 rows=130 width=0) (never executed)

  • Index Cond: (followed_uid = activities.user_uid)
17. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on followed_users fu_1 (cost=4.47..27.72 rows=5 width=16) (never executed)

  • Recheck Cond: (follower_uid = 'f28b119e-971c-4b74-890b-e2b22115920a'::uuid)
  • Filter: (deleted_at IS NULL)
18. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on followed_users_follower_uid_index (cost=0.00..4.46 rows=6 width=0) (never executed)

  • Index Cond: (follower_uid = 'f28b119e-971c-4b74-890b-e2b22115920a'::uuid)
19. 0.065 0.380 ↑ 19.0 1 19

Nested Loop (cost=0.84..25.03 rows=19 width=16) (actual time=0.020..0.020 rows=1 loops=19)

20. 0.114 0.114 ↑ 3.2 4 19

Index Scan using sections_activity_uid_index on sections es (cost=0.42..8.04 rows=13 width=32) (actual time=0.004..0.006 rows=4 loops=19)

  • Index Cond: (activity_uid = activities.uid)
21. 0.201 0.201 ↓ 0.0 0 67

Index Scan using enrollments_section_uid_index on enrollments e (cost=0.42..1.25 rows=6 width=16) (actual time=0.003..0.003 rows=0 loops=67)

  • Index Cond: (section_uid = es.uid)
  • Filter: (confirmed_at IS NOT NULL)
  • Rows Removed by Filter: 0
Planning time : 0.779 ms
Execution time : 85.204 ms