explain.depesz.com

A tool for finding a real cause for slow queries.

Result: ksx

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 0.512 275.143 ↑ 8.6 693 1

Sort (cost=249,569.46..249,584.29 rows=5,930 width=36) (actual time=275.104..275.143 rows=693 loops=1)

  • Sort Key: (CASE WHEN (ic.license_count = 0) THEN NULL::double precision ELSE (((SubPlan 2))::double precision / (ic.license_count)::double precision) END)
  • Sort Method: quicksort Memory: 122kB
2. 25.379 274.631 ↑ 8.6 693 1

Seq Scan on institution_courses ic (cost=0.00..249,197.84 rows=5,930 width=36) (actual time=0.109..274.631 rows=693 loops=1)

  • Filter: (CASE WHEN (license_count = 0) THEN NULL::double precision ELSE (((SubPlan 3))::double precision / (license_count)::double precision) END > 1::double precision)
3.          

SubPlan (forSeq Scan)

4. 4.851 36.036 ↑ 1.0 1 693

Aggregate (cost=8.37..8.38 rows=1 width=0) (actual time=0.052..0.052 rows=1 loops=693)

5. 31.185 31.185 ↓ 79.0 79 693

Index Scan using pk_supervisor on institution_role ir (cost=0.00..8.37 rows=1 width=0) (actual time=0.006..0.045 rows=79 loops=693)

  • Index Cond: ((institution_id = ic.institution_id) AND (course_id = ic.course_id))
  • Filter: ((user_role)::text = 'student'::text)
6. 4.851 36.036 ↑ 1.0 1 693

Aggregate (cost=8.37..8.38 rows=1 width=0) (actual time=0.052..0.052 rows=1 loops=693)

7. 31.185 31.185 ↓ 79.0 79 693

Index Scan using pk_supervisor on institution_role ir (cost=0.00..8.37 rows=1 width=0) (actual time=0.005..0.045 rows=79 loops=693)

  • Index Cond: ((institution_id = ic.institution_id) AND (course_id = ic.course_id))
  • Filter: ((user_role)::text = 'student'::text)
8. 17.718 177.180 ↑ 1.0 1 17,718

Aggregate (cost=8.37..8.38 rows=1 width=0) (actual time=0.010..0.010 rows=1 loops=17,718)

9. 159.462 159.462 ↓ 8.0 8 17,718

Index Scan using pk_supervisor on institution_role ir (cost=0.00..8.37 rows=1 width=0) (actual time=0.005..0.009 rows=8 loops=17,718)

  • Index Cond: ((institution_id = ic.institution_id) AND (course_id = ic.course_id))
  • Filter: ((user_role)::text = 'student'::text)