explain.depesz.com

PostgreSQL's explain analyze made readable

Result: KXHt

Settings
# exclusive inclusive rows x rows loops node
1. 26.063 648.275 ↓ 1.5 2,773 1

Limit (cost=70.41..137,475.69 rows=1,888 width=212) (actual time=25.768..648.275 rows=2,773 loops=1)

  • Functions: 25
  • Options: Inlining false, Optimization false, Expressions true, Deforming true
  • Timing: Generation 5.350 ms, Inlining 0.000 ms, Optimization 1.205 ms, Emission 23.564 ms, Total 30.118 ms
2. 4.331 622.212 ↓ 1.5 2,773 1

Nested Loop Left Join (cost=70.41..137,475.69 rows=1,888 width=212) (actual time=0.317..622.212 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.300 81.301 ↓ 1.6 2,981 1

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

4. 3.636 38.267 ↓ 1.6 2,981 1

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

5. 28.669 28.669 ↓ 1.6 2,981 1

Seq Scan on stocks s (cost=0.00..3,684.32 rows=1,897 width=134) (actual time=0.053..28.669 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. 5.962 5.962 ↑ 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.002..0.002 rows=1 loops=2,981)

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

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

8. 5.962 11.924 ↑ 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.004..0.004 rows=2 loops=2,981)

  • Recheck Cond: (id = ANY (s.statuses))
  • Heap Blocks: exact=2,981
9. 5.962 5.962 ↑ 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.002..0.002 rows=2 loops=2,981)

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

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

11. 530.618 530.618 ↓ 0.0 0 2,981

Seq Scan on shipments shipment (cost=0.00..49.95 rows=1 width=8) (actual time=0.145..0.178 rows=0 loops=2,981)

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