explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1etO

Settings
# exclusive inclusive rows x rows loops node
1. 776.951 2,340.342 ↓ 6.2 3,585 1

HashAggregate (cost=2,281.78..2,287.59 rows=581 width=81) (actual time=2,339.124..2,340.342 rows=3,585 loops=1)

  • Group Key: sr.quiz_id, q.id
2. 581.602 1,563.391 ↓ 5,960.6 3,463,119 1

Nested Loop (cost=771.79..2,278.87 rows=581 width=81) (actual time=4.290..1,563.391 rows=3,463,119 loops=1)

3. 10.102 13.949 ↓ 3,680.0 3,680 1

Seq Scan on quiz q (cost=771.36..2,224.13 rows=1 width=77) (actual time=4.263..13.949 rows=3,680 loops=1)

  • Filter: ((hashed SubPlan 1) AND ((((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'quiz'::text))::text)::integer IS NULL) OR ((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'quiz'::text))::text)::integer & 1) = 1)) AND ((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'all'::text))::text)::integer IS NULL) OR ((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'all'::text))::text)::integer & 1) = 1))) OR (((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'quiz'::text))::text)::integer IS NULL) OR ((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'quiz'::text))::text)::integer & 15) = 15)) AND ((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'all'::text))::text)::integer IS NULL) OR ((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'all'::text))::text)::integer & 15) = 15)))))
  • Rows Removed by Filter: 2276
4.          

SubPlan (forSeq Scan)

5. 3.847 3.847 ↓ 711.0 711 1

Seq Scan on "user" (cost=0.00..771.36 rows=1 width=4) (actual time=0.710..3.847 rows=711 loops=1)

  • Filter: ((((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'user'::text))::text)::integer IS NULL) OR ((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'user'::text))::text)::integer & 1) = 1)) AND ((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'all'::text))::text)::integer IS NULL) OR ((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'all'::text))::text)::integer & 1) = 1)) AND (org_id = (current_setting('jwt.claims.org_id'::text, true))::integer)) OR (((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'user'::text))::text)::integer IS NULL) OR ((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'user'::text))::text)::integer & 1) = 1)) AND ((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'all'::text))::text)::integer IS NULL) OR ((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'all'::text))::text)::integer & 1) = 1)) AND (client_id = (current_setting('jwt.claims.client_id'::text, true))::integer)) OR (((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'user'::text))::text)::integer IS NULL) OR ((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'user'::text))::text)::integer & 15) = 15)) AND ((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'all'::text))::text)::integer IS NULL) OR ((((((((current_setting('jwt.claims.data'::text, true))::json -> 'permission'::text) -> 'access'::text) -> 'all'::text))::text)::integer & 15) = 15)) AND (client_id = (current_setting('jwt.claims.client_id'::text, true))::integer)))
  • Rows Removed by Filter: 1217
6. 967.840 967.840 ↑ 1.1 941 3,680

Index Only Scan using student_response_quiz_id_index on student_response sr (cost=0.43..44.81 rows=993 width=4) (actual time=0.007..0.263 rows=941 loops=3,680)

  • Index Cond: (quiz_id = q.id)
  • Heap Fetches: 3463119
Planning time : 0.551 ms
Execution time : 2,340.752 ms