explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 7U4l : Optimization for: Optimization for: plan #订单列表

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.675 88.458 ↑ 1.0 1 1

Aggregate (cost=1,194.28..1,194.29 rows=1 width=8) (actual time=88.458..88.458 rows=1 loops=1)

2. 1.257 87.783 ↓ 2,029.0 8,116 1

Subquery Scan on base (cost=1,170.80..1,194.27 rows=4 width=0) (actual time=81.801..87.783 rows=8,116 loops=1)

  • Filter: (base.rank = 1)
  • Rows Removed by Filter: 40
3. 4.060 86.526 ↓ 11.3 8,156 1

WindowAgg (cost=1,170.80..1,185.24 rows=722 width=98) (actual time=81.800..86.526 rows=8,156 loops=1)

4. 2.892 82.466 ↓ 11.3 8,156 1

Sort (cost=1,170.80..1,172.61 rows=722 width=8) (actual time=81.791..82.466 rows=8,156 loops=1)

  • Sort Key: user_student.id DESC
  • Sort Method: quicksort Memory: 575kB
5. 0.694 79.574 ↓ 11.3 8,156 1

Nested Loop (cost=1.69..1,136.52 rows=722 width=8) (actual time=0.109..79.574 rows=8,156 loops=1)

6. 1.468 5.476 ↓ 11.3 8,156 1

Nested Loop (cost=1.27..802.93 rows=722 width=25) (actual time=0.100..5.476 rows=8,156 loops=1)

7. 0.027 0.456 ↑ 1.2 37 1

Nested Loop (cost=0.85..171.89 rows=44 width=25) (actual time=0.036..0.456 rows=37 loops=1)

8. 0.022 0.327 ↑ 1.0 51 1

Nested Loop (cost=0.57..155.65 rows=51 width=33) (actual time=0.020..0.327 rows=51 loops=1)

9. 0.050 0.050 ↑ 1.0 51 1

Index Scan using class_tutor_id_idx on class (cost=0.29..49.05 rows=51 width=50) (actual time=0.010..0.050 rows=51 loops=1)

  • Index Cond: ((tutor_id)::text = '5ddcd6d00ebe400001599700'::text)
10. 0.255 0.255 ↑ 1.0 1 51

Index Scan using curriculum_curriculum_id_idx on curriculum (cost=0.28..2.09 rows=1 width=33) (actual time=0.005..0.005 rows=1 loops=51)

  • Index Cond: ((curriculum_id)::text = (class.curriculum_id)::text)
11. 0.102 0.102 ↑ 1.0 1 51

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.002..0.002 rows=1 loops=51)

  • Index Cond: (curriculum_id = curriculum.id)
  • Filter: (genre = ANY ('{1,8}'::bigint[]))
  • Rows Removed by Filter: 0
  • Heap Fetches: 37
12. 3.552 3.552 ↓ 4.7 220 37

Index Scan using curriculum_record_class_id_idx on curriculum_record (cost=0.42..13.87 rows=47 width=49) (actual time=0.007..0.096 rows=220 loops=37)

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

Index Scan using user_student_user_student_id_idx on user_student (cost=0.41..0.46 rows=1 width=33) (actual time=0.009..0.009 rows=1 loops=8,156)

  • Index Cond: ((user_student_id)::text = (curriculum_record.student_id)::text)
Planning time : 1.657 ms