explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Eiba

Settings
# exclusive inclusive rows x rows loops node
1. 0.424 82.381 ↓ 1.5 2,773 1

Limit (cost=28.76..58,456.16 rows=1,888 width=212) (actual time=0.176..82.381 rows=2,773 loops=1)

2. 2.543 81.957 ↓ 1.5 2,773 1

Nested Loop Left Join (cost=28.76..58,456.16 rows=1,888 width=212) (actual time=0.175..81.957 rows=2,773 loops=1)

  • Filter: (((sa.step_id = 6) AND ((max(shipment.real_pick_up_date)) >= (now() - '6 mons'::interval))) OR (sa.step_id <> 6))
  • Rows Removed by Filter: 208
3. 1.990 70.471 ↓ 1.6 2,981 1

Nested Loop Left Join (cost=20.46..42,635.18 rows=1,897 width=212) (actual time=0.162..70.471 rows=2,981 loops=1)

4. 3.464 32.709 ↓ 1.6 2,981 1

Nested Loop (cost=0.15..4,049.93 rows=1,897 width=202) (actual time=0.076..32.709 rows=2,981 loops=1)

5. 26.264 26.264 ↓ 1.6 2,981 1

Seq Scan on stocks s (cost=0.00..3,684.32 rows=1,897 width=134) (actual time=0.052..26.264 rows=2,981 loops=1)

  • Filter: ((NOT is_deleted) AND (orientation = 'Supplier'::text) AND (((type_of_return = 'A return'::text) AND (cr2_date IS NOT NULL)) OR ((type_of_return = 'B return'::text) AND (tfp_date IS NOT NULL))))
  • Rows Removed by Filter: 2,882
6. 2.981 2.981 ↑ 1.0 1 2,981

Index Scan using steps_actions_pkey on steps_actions sa (cost=0.15..0.19 rows=1 width=76) (actual time=0.001..0.001 rows=1 loops=2,981)

  • Index Cond: (id = s.step_action_id)
7. 26.829 35.772 ↑ 1.0 1 2,981

Aggregate (cost=20.31..20.32 rows=1 width=32) (actual time=0.012..0.012 rows=1 loops=2,981)

8. 5.962 8.943 ↑ 5.0 2 2,981

Bitmap Heap Scan on ref_stock_statuses status (cost=9.60..20.26 rows=10 width=40) (actual time=0.003..0.003 rows=2 loops=2,981)

  • Recheck Cond: (id = ANY (s.statuses))
  • Heap Blocks: exact=2,981
9. 2.981 2.981 ↑ 5.0 2 2,981

Bitmap Index Scan on ref_stock_statuses_pkey (cost=0.00..9.60 rows=10 width=0) (actual time=0.001..0.001 rows=2 loops=2,981)

  • Index Cond: (id = ANY (s.statuses))
10. 2.981 8.943 ↑ 1.0 1 2,981

Aggregate (cost=8.30..8.31 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=2,981)

11. 5.962 5.962 ↓ 0.0 0 2,981

Index Scan using shipments_stock_id_idx on shipments shipment (cost=0.28..8.29 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=2,981)

  • Index Cond: (stock_id = s.id)
Planning time : 0.906 ms
Execution time : 82.815 ms