explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ZSiL

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.468 23.451 ↓ 19.9 757 1

WindowAgg (cost=1,454.17..1,454.93 rows=38 width=110) (actual time=22.927..23.451 rows=757 loops=1)

2. 2.580 22.983 ↓ 19.9 757 1

Sort (cost=1,454.17..1,454.26 rows=38 width=102) (actual time=22.919..22.983 rows=757 loops=1)

  • Sort Method: quicksort Memory: 179kB
  • Sort Key: curriculum_record.student_id, curriculum_record.paid_datetime DESC NULLS LAST
3. 0.776 20.403 ↓ 19.9 757 1

Nested Loop (cost=150.62..1,453.17 rows=38 width=102) (actual time=5.877..20.403 rows=757 loops=1)

4. 18.870 18.870 ↓ 17.2 757 1

Nested Loop (cost=150.34..1,439.16 rows=44 width=118) (actual time=5.865..18.870 rows=757 loops=1)

5. 0.000 0.757 ↑ 1.0 1 757

Index Only Scan using curriculum_genre_curriculum_id_genre_idx on curriculum_genre (cost=0.28..0.31 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=757)

  • Index Cond: (curriculum_id = curriculum.id)
  • Heap Fetches: 757
  • Filter: (genre = ANY ('{1,8}'::bigint[]))
6. 17.220 17.220 ↓ 8.1 757 1

Nested Loop (cost=150.05..1,409.03 rows=94 width=118) (actual time=5.854..17.220 rows=757 loops=1)

7. 0.000 1.514 ↑ 1.0 1 757

Index Scan using student_transfer_user_student_id_idx on student_transfer (cost=0.29..0.32 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=757)

  • Index Cond: (user_student_id = user_student.id)
  • Filter: (transfer_status = ANY ('{2002,1002,2003,1003,2004,1004}'::integer[]))
8. 5.299 5.299 ↑ 1.0 1 757

Index Scan using user_student_user_student_id_idx on user_student (cost=0.41..0.46 rows=1 width=61) (actual time=0.007..0.007 rows=1 loops=757)

9. 0.441 11.077 ↓ 8.1 757 1

Hash Join (cost=149.63..1,365.59 rows=94 width=57) (actual time=5.836..11.077 rows=757 loops=1)

  • Index Cond: ((user_student_id)::text = (curriculum_record.student_id)::text)
  • Hash Cond: (curriculum.id = curriculum_quarter.curriculum_id)
10. 10.105 10.105 ↓ 2.2 1,907 1

Nested Loop (cost=1.27..1,214.94 rows=874 width=49) (actual time=0.045..10.105 rows=1,907 loops=1)

11. 0.000 0.531 ↑ 2.4 226 1

Hash (cost=141.52..141.52 rows=547 width=8) (actual time=0.530..0.531 rows=226 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 17kB
12. 0.493 0.493 ↑ 2.4 226 1

Seq Scan on curriculum_quarter (cost=0.00..141.52 rows=547 width=8) (actual time=0.007..0.493 rows=226 loops=1)

13. 2.619 2.619 ↓ 2.2 1,907 1

Nested Loop (cost=0.99..950.58 rows=874 width=66) (actual time=0.037..2.619 rows=1,907 loops=1)

14. 3.574 5.721 ↑ 1.0 1 1,907

Index Scan using curriculum_curriculum_id_idx on curriculum (cost=0.28..0.30 rows=1 width=33) (actual time=0.003..0.003 rows=1 loops=1,907)

  • Rows Removed by Filter: 4,597
  • Index Cond: ((curriculum_id)::text = (curriculum_record.curriculum_id)::text)
  • Filter: ((year = 2,020) AND (quarter = 4))
15. 0.453 0.453 ↓ 1.5 77 1

Nested Loop (cost=0.57..228.09 rows=53 width=33) (actual time=0.025..0.453 rows=77 loops=1)

16. 1.302 1.694 ↑ 1.9 25 77

Index Scan using curriculum_record_class_id_idx on curriculum_record (cost=0.42..13.16 rows=47 width=82) (actual time=0.008..0.022 rows=25 loops=77)

  • Rows Removed by Filter: 2
  • Index Cond: ((class_id)::text = (class.class_id)::text)
  • Filter: (status = ANY ('{2,5}'::integer[]))
17. 0.308 0.308 ↑ 1.0 1 77

Index Scan using user_teacher_user_teacher_id_idx on user_teacher (cost=0.29..2.05 rows=1 width=33) (actual time=0.004..0.004 rows=1 loops=77)

18. 0.084 0.084 ↑ 1.0 77 1

Index Scan using class_tutor_id_idx on class (cost=0.29..70.60 rows=77 width=49) (actual time=0.015..0.084 rows=77 loops=1)

  • Index Cond: ((user_teacher_id)::text = (class.tutor_id)::text)
  • Index Cond: ((tutor_id)::text = ANY ('{5d8b099c305d9a0001c28dce,5a3338aade18e200015830b8}'::text[]))
Planning time : 3.677 ms
Execution time : 23.595 ms