explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ytET

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

Limit (cost=18.03..4,270.44 rows=200 width=243) (actual time=0.097..5.046 rows=200 loops=1)

2. 0.105 5.018 ↑ 23.6 200 1

Nested Loop Left Join (cost=18.03..100,523.62 rows=4,727 width=243) (actual time=0.096..5.018 rows=200 loops=1)

3. 0.100 4.513 ↑ 23.6 200 1

Nested Loop Left Join (cost=9.72..61,112.25 rows=4,727 width=211) (actual time=0.086..4.513 rows=200 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: 13
4. 0.053 3.774 ↑ 24.3 213 1

Nested Loop Left Join (cost=1.42..17,838.81 rows=5,184 width=211) (actual time=0.072..3.774 rows=213 loops=1)

5. 0.071 2.017 ↑ 24.3 213 1

Nested Loop Left Join (cost=0.29..11,799.45 rows=5,184 width=205) (actual time=0.046..2.017 rows=213 loops=1)

6. 0.211 1.530 ↑ 24.9 208 1

Nested Loop (cost=0.00..9,879.45 rows=5,184 width=205) (actual time=0.038..1.530 rows=208 loops=1)

  • Join Filter: (s.step_action_id = sa.id)
  • Rows Removed by Join Filter: 784
7. 1.319 1.319 ↑ 24.9 208 1

Seq Scan on stocks s (cost=0.00..9,087.72 rows=5,184 width=137) (actual time=0.024..1.319 rows=208 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: 175
8. 0.000 0.000 ↑ 2.2 5 208

Materialize (cost=0.00..1.17 rows=11 width=76) (actual time=0.000..0.000 rows=5 loops=208)

9. 0.006 0.006 ↑ 1.0 11 1

Seq Scan on steps_actions sa (cost=0.00..1.11 rows=11 width=76) (actual time=0.004..0.006 rows=11 loops=1)

10. 0.416 0.416 ↑ 1.0 1 208

Index Only Scan using idx_transfer_orders_stock_id on transfer_orders to2 (cost=0.29..0.36 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=208)

  • Index Cond: (stock_id = s.id)
  • Heap Fetches: 8
11. 1.491 1.704 ↑ 1.0 1 213

Aggregate (cost=1.14..1.15 rows=1 width=32) (actual time=0.008..0.008 rows=1 loops=213)

12. 0.213 0.213 ↑ 2.0 2 213

Seq Scan on ref_stock_statuses status (cost=0.00..1.11 rows=4 width=40) (actual time=0.001..0.001 rows=2 loops=213)

  • Filter: (id = ANY (s.statuses))
  • Rows Removed by Filter: 3
13. 0.213 0.639 ↑ 1.0 1 213

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

14. 0.426 0.426 ↓ 0.0 0 213

Index Scan using idx_shipments_stock_id on shipments shipment (cost=0.29..8.30 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=213)

  • Index Cond: (stock_id = s.id)
15. 0.200 0.400 ↑ 1.0 1 200

Aggregate (cost=8.31..8.32 rows=1 width=32) (actual time=0.002..0.002 rows=1 loops=200)

16. 0.200 0.200 ↑ 1.0 1 200

Index Scan using idx_transfer_orders_stock_id on transfer_orders ots (cost=0.29..8.30 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=200)

  • Index Cond: (stock_id = s.id)
Planning time : 0.693 ms
Execution time : 5.158 ms