explain.depesz.com

PostgreSQL's explain analyze made readable

Result: zk4i

Settings
# exclusive inclusive rows x rows loops node
1. 0.100 389.371 ↑ 1.0 200 1

Limit (cost=1,014.51..90,150.03 rows=200 width=243) (actual time=11.083..389.371 rows=200 loops=1)

2. 0.404 389.271 ↑ 23.6 200 1

Nested Loop Left Join (cost=1,014.51..2,107,732.65 rows=4,727 width=243) (actual time=11.081..389.271 rows=200 loops=1)

3. 0.480 18.267 ↑ 23.6 200 1

Nested Loop Left Join (cost=581.14..59,062.67 rows=4,727 width=211) (actual time=7.952..18.267 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: 11
4. 0.377 16.099 ↑ 24.6 211 1

Nested Loop Left Join (cost=572.84..15,789.23 rows=5,184 width=211) (actual time=7.908..16.099 rows=211 loops=1)

5. 0.369 12.135 ↑ 24.6 211 1

Hash Left Join (cost=571.70..9,749.87 rows=5,184 width=205) (actual time=7.829..12.135 rows=211 loops=1)

  • Hash Cond: (s.id = to2.stock_id)
6. 0.282 4.038 ↑ 25.5 203 1

Hash Join (cost=1.25..9,107.81 rows=5,184 width=205) (actual time=0.055..4.038 rows=203 loops=1)

  • Hash Cond: (s.step_action_id = sa.id)
7. 3.738 3.738 ↑ 25.5 203 1

Seq Scan on stocks s (cost=0.00..9,087.72 rows=5,184 width=137) (actual time=0.026..3.738 rows=203 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: 85
8. 0.009 0.018 ↑ 1.0 11 1

Hash (cost=1.11..1.11 rows=11 width=76) (actual time=0.017..0.018 rows=11 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
9. 0.009 0.009 ↑ 1.0 11 1

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

10. 3.187 7.728 ↑ 1.0 13,709 1

Hash (cost=399.09..399.09 rows=13,709 width=4) (actual time=7.728..7.728 rows=13,709 loops=1)

  • Buckets: 16,384 Batches: 1 Memory Usage: 610kB
11. 4.541 4.541 ↑ 1.0 13,709 1

Seq Scan on transfer_orders to2 (cost=0.00..399.09 rows=13,709 width=4) (actual time=0.008..4.541 rows=13,709 loops=1)

12. 2.954 3.587 ↑ 1.0 1 211

Aggregate (cost=1.14..1.15 rows=1 width=32) (actual time=0.017..0.017 rows=1 loops=211)

13. 0.633 0.633 ↑ 2.0 2 211

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

  • Filter: (id = ANY (s.statuses))
  • Rows Removed by Filter: 3
14. 0.422 1.688 ↑ 1.0 1 211

Aggregate (cost=8.30..8.31 rows=1 width=8) (actual time=0.008..0.008 rows=1 loops=211)

15. 1.266 1.266 ↓ 0.0 0 211

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

  • Index Cond: (stock_id = s.id)
16. 0.800 370.600 ↑ 1.0 1 200

Aggregate (cost=433.37..433.38 rows=1 width=32) (actual time=1.853..1.853 rows=1 loops=200)

17. 369.800 369.800 ↑ 1.0 1 200

Seq Scan on transfer_orders ots (cost=0.00..433.36 rows=1 width=4) (actual time=1.778..1.849 rows=1 loops=200)

  • Filter: (s.id = stock_id)
  • Rows Removed by Filter: 13,708
Planning time : 1.103 ms
Execution time : 389.614 ms