explain.depesz.com

PostgreSQL's explain analyze made readable

Result: wgph

Settings
# exclusive inclusive rows x rows loops node
1. 0.046 3.704 ↑ 3.2 11 1

Result (cost=1.10..3,421.69 rows=35 width=92) (actual time=0.643..3.704 rows=11 loops=1)

  • One-Time Filter: (((((((((safe_current_setting('jwt.claims.data'::text))::json -> 'permission'::text) -> 'access'::text) -> 'roster'::text))::text)::integer IS NULL) OR ((((((((safe_current_setting('jwt.claims.data'::text))::json -> 'permission'::text) -> 'access'::text) -> 'roster'::text))::text)::integer & 1) > 0)) AND ((((((((safe_current_setting('jwt.claims.data'::text))::json -> 'permission'::text) -> 'access'::text) -> 'all'::text))::text)::integer IS NULL) OR ((((((((safe_current_setting('jwt.claims.data'::text))::json -> 'permission'::text) -> 'access'::text) -> 'all'::text))::text)::integer & 1) > 0)))
2. 2.250 3.658 ↑ 3.2 11 1

Seq Scan on roster (cost=1.10..3,421.69 rows=35 width=92) (actual time=0.598..3.658 rows=11 loops=1)

  • Filter: ((org_term_id = (safe_current_setting('jwt.claims.org_term_id'::text))::integer) AND (check_instructor_roster(roster.*) OR ((SubPlan 1) >= 1) OR (class_teacher_id = (safe_current_setting('jwt.claims.user_id'::text))::integer)))
  • Rows Removed by Filter: 363
3.          

SubPlan (forSeq Scan)

4. 0.000 1.408 ↑ 1.0 1 64

Aggregate (cost=8.57..8.58 rows=1 width=8) (actual time=0.022..0.022 rows=1 loops=64)

5. 1.216 1.408 ↓ 0.0 0 64

Result (cost=0.29..8.56 rows=1 width=8) (actual time=0.022..0.022 rows=0 loops=64)

  • One-Time Filter: (((((((((safe_current_setting('jwt.claims.data'::text))::json -> 'permission'::text) -> 'access'::text) -> 'subject_teacher'::text))::text)::integer IS NULL) OR ((((((((safe_current_setting('jwt.claims.data'::text))::json -> 'permission'::text) -> 'access'::text) -> 'subject_teacher'::text))::text)::integer & 1) > 0)) AND ((((((((safe_current_setting('jwt.claims.data'::text))::json -> 'permission'::text) -> 'access'::text) -> 'all'::text))::text)::integer IS NULL) OR ((((((((safe_current_setting('jwt.claims.data'::text))::json -> 'permission'::text) -> 'access'::text) -> 'all'::text))::text)::integer & 1) > 0)) AND ((safe_current_setting('jwt.claims.user_id'::text))::integer = (current_setting('jwt.claims.user_id'::text))::integer))
6. 0.192 0.192 ↓ 0.0 0 64

Index Scan using subject_teacher_unique on subject_teacher t (cost=0.29..8.56 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=64)

  • Index Cond: ((roster_id = roster.id) AND (teacher_id = (current_setting('jwt.claims.user_id'::text))::integer))
  • Filter: (org_term_id = (safe_current_setting('jwt.claims.org_term_id'::text))::integer)
Planning time : 0.712 ms
Execution time : 3.795 ms