explain.depesz.com

PostgreSQL's explain analyze made readable

Result: f6kR

Settings
# exclusive inclusive rows x rows loops node
1. 0.028 128.473 ↑ 1.0 1 1

Aggregate (cost=3,762,484.26..3,762,484.27 rows=1 width=8) (actual time=128.473..128.473 rows=1 loops=1)

2. 0.004 128.445 ↑ 18.5 14 1

Nested Loop (cost=3,943.40..3,762,483.61 rows=259 width=6) (actual time=105.974..128.445 rows=14 loops=1)

3. 107.648 128.409 ↑ 3.4 8 1

Bitmap Heap Scan on production_order po (cost=3,942.97..3,758,322.77 rows=27 width=6) (actual time=105.966..128.409 rows=8 loops=1)

  • Recheck Cond: (actual_status_id = ANY ('{5,6,4}'::numeric[]))
  • Filter: ((reproduction_statuses IS NULL) AND ((NOT rowa_export) OR (rowa_export IS NULL)) AND (NOT bulk_order) AND (pharmacy_id = '10317'::numeric) AND ((SubPlan 1) >= '2020-01-01 00:00:00'::timestamp without time zone) AND ((SubPlan 2) < '2020-01-31 23:59:59'::timestamp without time zone))
  • Rows Removed by Filter: 220444
  • Heap Blocks: exact=12321
4. 18.850 18.850 ↑ 1.0 220,452 1

Bitmap Index Scan on idx_production_order_created_status (cost=0.00..3,942.97 rows=220,494 width=0) (actual time=18.850..18.850 rows=220,452 loops=1)

  • Index Cond: (actual_status_id = ANY ('{5,6,4}'::numeric[]))
5.          

SubPlan (for Bitmap Heap Scan)

6. 0.000 1.878 ↑ 1.0 1 313

Limit (cost=0.42..8.47 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=313)

7. 1.878 1.878 ↑ 1.0 1 313

Index Only Scan using pk_production_order_status_history on production_order_status_history h (cost=0.42..8.47 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=313)

  • Index Cond: ((production_order_id = po.id) AND (status_id = '4'::numeric))
  • Heap Fetches: 313
8. 0.000 0.033 ↑ 1.0 1 11

Limit (cost=0.42..8.47 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=11)

9. 0.033 0.033 ↑ 1.0 1 11

Index Only Scan using pk_production_order_status_history on production_order_status_history h_1 (cost=0.42..8.47 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=11)

  • Index Cond: ((production_order_id = po.id) AND (status_id = '4'::numeric))
  • Heap Fetches: 11
10. 0.032 0.032 ↑ 25.0 2 8

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

  • Index Cond: (production_order_id = po.id)