explain.depesz.com

PostgreSQL's explain analyze made readable

Result: lhuP

Settings
# exclusive inclusive rows x rows loops node
1. 0.116 439.185 ↑ 1.0 200 1

Limit (cost=444.06..89,576.55 rows=200 width=243) (actual time=5.656..439.185 rows=200 loops=1)

2. 0.308 439.069 ↑ 23.6 200 1

Nested Loop Left Join (cost=444.06..2,107,090.60 rows=4,727 width=243) (actual time=5.654..439.069 rows=200 loops=1)

3. 0.758 14.961 ↑ 23.6 200 1

Nested Loop Left Join (cost=10.69..58,420.61 rows=4,727 width=211) (actual time=0.525..14.961 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: 71
4. 0.542 10.951 ↑ 19.1 271 1

Nested Loop Left Join (cost=2.38..15,147.17 rows=5,184 width=211) (actual time=0.343..10.951 rows=271 loops=1)

5. 0.635 4.989 ↑ 19.1 271 1

Hash Join (cost=1.25..9,107.81 rows=5,184 width=205) (actual time=0.302..4.989 rows=271 loops=1)

  • Hash Cond: (s.step_action_id = sa.id)
6. 4.331 4.331 ↑ 19.1 271 1

Seq Scan on stocks s (cost=0.00..9,087.72 rows=5,184 width=137) (actual time=0.124..4.331 rows=271 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: 460
7. 0.007 0.023 ↑ 1.0 11 1

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

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

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

9. 4.607 5.420 ↑ 1.0 1 271

Aggregate (cost=1.14..1.15 rows=1 width=32) (actual time=0.020..0.020 rows=1 loops=271)

10. 0.813 0.813 ↑ 2.0 2 271

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=271)

  • Filter: (id = ANY (s.statuses))
  • Rows Removed by Filter: 3
11. 0.542 3.252 ↑ 1.0 1 271

Aggregate (cost=8.30..8.31 rows=1 width=8) (actual time=0.012..0.012 rows=1 loops=271)

12. 2.710 2.710 ↑ 1.0 1 271

Index Scan using idx_shipments_stock_id on shipments shipment (cost=0.29..8.30 rows=1 width=8) (actual time=0.008..0.010 rows=1 loops=271)

  • Index Cond: (stock_id = s.id)
13. 1.200 423.800 ↑ 1.0 1 200

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

14. 422.600 422.600 ↓ 0.0 0 200

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

  • Filter: (stock_id = s.id)
  • Rows Removed by Filter: 13,709
Planning time : 0.832 ms
Execution time : 439.347 ms