explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ks1P

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.045 ↓ 0.0 0 1

Hash Left Join (cost=75.53..117.23 rows=192 width=524) (actual time=0.045..0.045 rows=0 loops=1)

  • Hash Cond: (ed.class_id = cd.class_id)
2. 0.000 0.045 ↓ 0.0 0 1

Hash Anti Join (cost=28.47..66.58 rows=192 width=30) (actual time=0.045..0.045 rows=0 loops=1)

  • Hash Cond: (core.get_notification_idempotent_id('class'::text, ed.class_id, (ed.datetime)::date) = (np.notification_idempotent_id)::text)
3. 0.001 0.045 ↓ 0.0 0 1

Bitmap Heap Scan on effective_datetimes ed (cost=8.80..17.12 rows=383 width=30) (actual time=0.045..0.045 rows=0 loops=1)

  • Recheck Cond: (((datetime <= (now() + '03:00:00'::interval)) AND (datetime >= now()) AND (channel_type = 'classroom'::classes.class_channel_type)) OR ((datetime <= (now() + '00:10:00'::interval)) AND (datetime >= now())))
  • Filter: ((NOT cancelled) AND (datetime >= now()) AND (((datetime <= (now() + '03:00:00'::interval)) AND (channel_type = 'classroom'::classes.class_channel_type)) OR ((datetime <= (now() + '00:10:00'::interval)) AND (channel_type <> 'classroom'::classes.class_channel_type))))
4. 0.001 0.044 ↓ 0.0 0 1

BitmapOr (cost=8.80..8.80 rows=3 width=0) (actual time=0.044..0.044 rows=0 loops=1)

5. 0.041 0.041 ↓ 0.0 0 1

Bitmap Index Scan on datetime_channel_idx (cost=0.00..4.31 rows=1 width=0) (actual time=0.041..0.041 rows=0 loops=1)

  • Index Cond: ((datetime <= (now() + '03:00:00'::interval)) AND (datetime >= now()) AND (channel_type = 'classroom'::classes.class_channel_type))
6. 0.002 0.002 ↓ 0.0 0 1

Bitmap Index Scan on datetime_channel_idx (cost=0.00..4.29 rows=1 width=0) (actual time=0.002..0.002 rows=0 loops=1)

  • Index Cond: ((datetime <= (now() + '00:10:00'::interval)) AND (datetime >= now()))
7. 0.000 0.000 ↓ 0.0 0

Hash (cost=14.30..14.30 rows=430 width=118) (never executed)

8. 0.000 0.000 ↓ 0.0 0

Seq Scan on notification_processed_new np (cost=0.00..14.30 rows=430 width=118) (never executed)

9. 0.000 0.000 ↓ 0.0 0

Hash (cost=45.42..45.42 rows=131 width=498) (never executed)

10. 0.000 0.000 ↓ 0.0 0

Subquery Scan on cd (cost=37.13..45.42 rows=131 width=498) (never executed)

11. 0.000 0.000 ↓ 0.0 0

Hash Left Join (cost=37.13..44.11 rows=131 width=3,261) (never executed)

  • Hash Cond: (cd_1.class_id = num_students.class_id)
12.          

CTE class_data

13. 0.000 0.000 ↓ 0.0 0

Seq Scan on class (cost=0.00..7.31 rows=131 width=481) (never executed)

14. 0.000 0.000 ↓ 0.0 0

Hash Left Join (cost=11.52..16.69 rows=131 width=498) (never executed)

  • Hash Cond: (cd_1.image = i.image_id)
15. 0.000 0.000 ↓ 0.0 0

Hash Left Join (cost=4.38..9.19 rows=131 width=454) (never executed)

  • Hash Cond: (cd_1.class_id = ctf.class_id)
16. 0.000 0.000 ↓ 0.0 0

Hash Left Join (cost=2.44..6.36 rows=131 width=454) (never executed)

  • Hash Cond: (cd_1.class_id = ctl.class_id)
17. 0.000 0.000 ↓ 0.0 0

CTE Scan on class_data cd_1 (cost=0.00..2.62 rows=131 width=462) (never executed)

18. 0.000 0.000 ↓ 0.0 0

Hash (cost=1.84..1.84 rows=48 width=8) (never executed)

19. 0.000 0.000 ↓ 0.0 0

Seq Scan on class_teacher ctl (cost=0.00..1.84 rows=48 width=8) (never executed)

  • Filter: (role = 'leader'::classes.teacher_role)
20. 0.000 0.000 ↓ 0.0 0

Hash (cost=1.84..1.84 rows=8 width=8) (never executed)

21. 0.000 0.000 ↓ 0.0 0

Seq Scan on class_teacher ctf (cost=0.00..1.84 rows=8 width=8) (never executed)

  • Filter: (role = 'follower'::classes.teacher_role)
22. 0.000 0.000 ↓ 0.0 0

Hash (cost=4.84..4.84 rows=184 width=52) (never executed)

23. 0.000 0.000 ↓ 0.0 0

Seq Scan on image i (cost=0.00..4.84 rows=184 width=52) (never executed)

24. 0.000 0.000 ↓ 0.0 0

Hash (cost=16.54..16.54 rows=141 width=4) (never executed)

25. 0.000 0.000 ↓ 0.0 0

Subquery Scan on num_students (cost=13.72..16.54 rows=141 width=4) (never executed)

26. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=13.72..15.13 rows=141 width=8) (never executed)

  • Group Key: class_couple.class_id, ((count(class_couple.leader_id))::smallint), ((count(class_couple.follower_id))::smallint)
27. 0.000 0.000 ↓ 0.0 0

Append (cost=1.68..12.67 rows=141 width=8) (never executed)

28. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=1.68..2.27 rows=39 width=8) (never executed)

  • Group Key: class_couple.class_id
29. 0.000 0.000 ↓ 0.0 0

Seq Scan on class_couple (cost=0.00..1.39 rows=39 width=12) (never executed)

30. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=7.01..8.29 rows=102 width=8) (never executed)

  • Group Key: class_student.class_id
31. 0.000 0.000 ↓ 0.0 0

Seq Scan on class_student (cost=0.00..5.34 rows=334 width=8) (never executed)

Planning time : 0.954 ms
Execution time : 0.125 ms