explain.depesz.com

PostgreSQL's explain analyze made readable

Result: WfwW

Settings
# exclusive inclusive rows x rows loops node
1. 32.362 597.741 ↓ 1.5 2,785 1

Limit (cost=70.41..138,039.83 rows=1,895 width=212) (actual time=32.125..597.741 rows=2,785 loops=1)

  • Functions: 25
  • Options: Inlining false, Optimization false, Expressions true, Deforming true
  • Timing: Generation 4.930 ms, Inlining 0.000 ms, Optimization 1.377 ms, Emission 29.872 ms, Total 36.179 ms
2. 4.158 565.379 ↓ 1.5 2,785 1

Nested Loop Left Join (cost=70.41..138,039.83 rows=1,895 width=212) (actual time=0.319..565.379 rows=2,785 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.641 76.355 ↓ 1.6 2,993 1

Nested Loop Left Join (cost=20.46..42,799.36 rows=1,905 width=212) (actual time=0.129..76.355 rows=2,993 loops=1)

4. 3.000 35.805 ↓ 1.6 2,993 1

Nested Loop (cost=0.15..4,051.39 rows=1,905 width=202) (actual time=0.076..35.805 rows=2,993 loops=1)

5. 26.819 26.819 ↓ 1.6 2,993 1

Seq Scan on stocks s (cost=0.00..3,684.43 rows=1,905 width=134) (actual time=0.056..26.819 rows=2,993 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,871
6. 5.986 5.986 ↑ 1.0 1 2,993

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

  • Index Cond: (id = s.step_action_id)
7. 29.930 38.909 ↑ 1.0 1 2,993

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

8. 5.986 8.979 ↑ 5.0 2 2,993

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,993)

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

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,993)

  • Index Cond: (id = ANY (s.statuses))
10. 2.993 484.866 ↑ 1.0 1 2,993

Aggregate (cost=49.95..49.96 rows=1 width=8) (actual time=0.162..0.162 rows=1 loops=2,993)

11. 481.873 481.873 ↓ 0.0 0 2,993

Seq Scan on shipments shipment (cost=0.00..49.95 rows=1 width=8) (actual time=0.131..0.161 rows=0 loops=2,993)

  • Filter: (stock_id = s.id)
  • Rows Removed by Filter: 1,836
Execution time : 603.380 ms