explain.depesz.com

PostgreSQL's explain analyze made readable

Result: uqCb : using union instead of or

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 2.153 ↓ 0.0 0 1

HashAggregate (cost=1,117.84..1,128.29 rows=1,045 width=16) (actual time=2.153..2.153 rows=0 loops=1)

  • Group Key: submissions.assignment_id, submissions.user_id
2.          

CTE assignment_batch

3. 0.023 0.023 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.023..0.023 rows=1 loops=1)

4. 0.001 2.151 ↓ 0.0 0 1

Append (cost=0.57..1,112.61 rows=1,045 width=16) (actual time=2.151..2.151 rows=0 loops=1)

5. 0.004 2.134 ↓ 0.0 0 1

Nested Loop (cost=0.57..11.81 rows=8 width=16) (actual time=2.134..2.134 rows=0 loops=1)

6. 0.038 0.038 ↑ 1.0 1 1

CTE Scan on assignment_batch (cost=0.00..0.02 rows=1 width=4) (actual time=0.037..0.038 rows=1 loops=1)

7. 2.092 2.092 ↓ 0.0 0 1

Index Scan using rosser_cowboy_submissions_assignment_id_by_grading_period on submissions (cost=0.57..11.71 rows=8 width=16) (actual time=2.092..2.092 rows=0 loops=1)

  • Index Cond: ((assignment_id = assignment_batch.assignment_id) AND (grading_period_id = ANY ('{348,349}'::bigint[])))
8. 0.009 0.016 ↓ 0.0 0 1

Result (cost=0.58..1,090.35 rows=1,037 width=16) (actual time=0.016..0.016 rows=0 loops=1)

  • One-Time Filter: (now() > '2019-10-03 16:50:20+00'::timestamp with time zone)
9. 0.001 0.007 ↓ 0.0 0 1

Nested Loop (cost=0.58..1,090.35 rows=1,037 width=16) (actual time=0.007..0.007 rows=0 loops=1)

10. 0.003 0.003 ↑ 1.0 1 1

CTE Scan on assignment_batch assignment_batch_1 (cost=0.00..0.02 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=1)

11. 0.003 0.003 ↓ 0.0 0 1

Index Scan using rosser_cowboy_submissions_assignment_id_by_grading_period on submissions submissions_1 (cost=0.57..1,079.96 rows=1,037 width=16) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: ((assignment_id = assignment_batch_1.assignment_id) AND (grading_period_id IS NULL))
Planning time : 17.206 ms
Execution time : 4.700 ms