explain.depesz.com

PostgreSQL's explain analyze made readable

Result: k7tFq : Optimization for: new query; plan #bMD

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.051 0.401 ↓ 8.5 17 1

Sort (cost=13.23..13.24 rows=2 width=20) (actual time=0.398..0.401 rows=17 loops=1)

  • Sort Key: r0.id DESC
  • Sort Method: quicksort Memory: 26kB
2. 0.052 0.350 ↓ 8.5 17 1

Nested Loop (cost=8.55..13.22 rows=2 width=20) (actual time=0.248..0.350 rows=17 loops=1)

  • Join Filter: (r0.id = receipt_job_states.receipt_id)
3. 0.013 0.213 ↓ 8.5 17 1

Unique (cost=8.41..8.42 rows=2 width=16) (actual time=0.196..0.213 rows=17 loops=1)

4. 0.027 0.200 ↓ 8.5 17 1

Sort (cost=8.41..8.42 rows=2 width=16) (actual time=0.195..0.200 rows=17 loops=1)

  • Sort Key: receipt_job_states.receipt_id
  • Sort Method: quicksort Memory: 25kB
5. 0.022 0.173 ↓ 8.5 17 1

Nested Loop (cost=2.25..8.40 rows=2 width=16) (actual time=0.089..0.173 rows=17 loops=1)

6. 0.033 0.100 ↓ 8.5 17 1

Hash Join (cost=2.11..3.54 rows=2 width=8) (actual time=0.067..0.100 rows=17 loops=1)

  • Hash Cond: (receipt_job_states.job_id = jobs.id)
7. 0.043 0.043 ↑ 1.1 17 1

Seq Scan on receipt_job_states (cost=0.00..1.36 rows=18 width=16) (actual time=0.020..0.043 rows=17 loops=1)

  • Filter: (exit_code > 0)
  • Rows Removed by Filter: 15
8. 0.011 0.024 ↓ 2.0 2 1

Hash (cost=2.10..2.10 rows=1 width=8) (actual time=0.024..0.024 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
9. 0.013 0.013 ↓ 2.0 2 1

Seq Scan on jobs (cost=0.00..2.10 rows=1 width=8) (actual time=0.006..0.013 rows=2 loops=1)

  • Filter: (project_id = 1)
  • Rows Removed by Filter: 3
10. 0.051 0.051 ↑ 1.0 1 17

Index Scan using receipts_pkey on receipts (cost=0.14..2.38 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=17)

  • Index Cond: (id = receipt_job_states.receipt_id)
  • Filter: (inserted_at >= '2019-01-01 00:00:00'::timestamp without time zone)
11. 0.085 0.085 ↑ 1.0 1 17

Index Scan using receipts_pkey on receipts r0 (cost=0.14..2.39 rows=1 width=20) (actual time=0.005..0.005 rows=1 loops=17)

  • Index Cond: (id = receipts.id)
  • Filter: ((inserted_at >= '2019-01-01 00:00:00'::timestamp without time zone) AND (inserted_at <= '2019-12-31 00:00:00'::timestamp without time zone) AND (project_id = 1))
Planning time : 1.699 ms
Execution time : 0.552 ms