explain.depesz.com

PostgreSQL's explain analyze made readable

Result: TgAtI

Settings
# exclusive inclusive rows x rows loops node
1. 0.018 1.034 ↑ 1.0 1 1

Aggregate (cost=2,857.68..2,857.69 rows=1 width=8) (actual time=1.034..1.034 rows=1 loops=1)

2. 0.007 1.016 ↑ 3.1 14 1

Nested Loop (cost=1.27..2,857.57 rows=43 width=6) (actual time=0.727..1.016 rows=14 loops=1)

  • Join Filter: (po.id = op.production_order_id)
3. 0.068 0.985 ↓ 1.6 8 1

Nested Loop (cost=0.84..2,445.94 rows=5 width=12) (actual time=0.718..0.985 rows=8 loops=1)

4. 0.291 0.291 ↓ 1.3 313 1

Index Scan using idx_test on production_order po (cost=0.42..447.08 rows=241 width=6) (actual time=0.013..0.291 rows=313 loops=1)

  • Index Cond: ((reproduction_statuses IS NULL) AND (pharmacy_id = '10317'::numeric) AND (actual_status_id = ANY ('{5,6,4}'::numeric[])) AND (bulk_order = false))
  • Filter: (NOT bulk_order)
5. 0.626 0.626 ↓ 0.0 0 313

Index Only Scan using pk_production_order_status_history on production_order_status_history h (cost=0.42..8.28 rows=1 width=6) (actual time=0.002..0.002 rows=0 loops=313)

  • Index Cond: ((production_order_id = po.id) AND (changed >= '2020-01-01 00:00:00'::timestamp without time zone) AND (changed < '2020-01-31 23:59:59'::timestamp without time zone) AND (status_id = '4'::numeric))
  • Heap Fetches: 8
6. 0.024 0.024 ↑ 25.0 2 8

Index Scan using idx_op_po_id on order_proposal op (cost=0.43..81.70 rows=50 width=12) (actual time=0.003..0.003 rows=2 loops=8)

  • Index Cond: (production_order_id = h.production_order_id)