explain.depesz.com

A tool for finding a real cause for slow queries.

Result: Egl

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=720774.91..721205.26 rows=1569 width=140) (actual time=.. rows= loops=)

  • Hash Cond: ((ppr.id = pbu.product_id) AND (ppa.ul = pbu.ul_id))
2.          

CTE location

3. 0.000 0.000 ↓ 0.0

Recursive Union (cost=0.00..8968.25 rows=46563 width=19) (actual time=.. rows= loops=)

4. 0.000 0.000 ↓ 0.0

Seq Scan on stock_warehouse sw (cost=0.00..1.03 rows=3 width=8) (actual time=.. rows= loops=)

5. 0.000 0.000 ↓ 0.0

Hash Join (cost=0.97..803.60 rows=4656 width=19) (actual time=.. rows= loops=)

  • Hash Cond: (sl.location_id = location.id)
6. 0.000 0.000 ↓ 0.0

Seq Scan on stock_location sl (cost=0.00..738.59 rows=4659 width=19) (actual time=.. rows= loops=)

7. 0.000 0.000 ↓ 0.0

Hash (cost=0.60..0.60 rows=30 width=4) (actual time=.. rows= loops=)

8. 0.000 0.000 ↓ 0.0

WorkTable Scan on location (cost=0.00..0.60 rows=30 width=4) (actual time=.. rows= loops=)

9. 0.000 0.000 ↓ 0.0

Hash Join (cost=55.30..473.88 rows=1569 width=12) (actual time=.. rows= loops=)

  • Hash Cond: (ppr.id = ppa.product_id)
10. 0.000 0.000 ↓ 0.0

Seq Scan on product_product ppr (cost=0.00..348.34 rows=6234 width=4) (actual time=.. rows= loops=)

11. 0.000 0.000 ↓ 0.0

Hash (cost=35.69..35.69 rows=1569 width=12) (actual time=.. rows= loops=)

12. 0.000 0.000 ↓ 0.0

Seq Scan on product_packaging ppa (cost=0.00..35.69 rows=1569 width=12) (actual time=.. rows= loops=)

13. 0.000 0.000 ↓ 0.0

Hash (cost=711749.31..711749.31 rows=136 width=136) (actual time=.. rows= loops=)

14. 0.000 0.000 ↓ 0.0

Subquery Scan on pbu (cost=711744.21..711749.31 rows=136 width=136) (actual time=.. rows= loops=)

15. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=711744.21..711747.95 rows=136 width=136) (actual time=.. rows= loops=)

16. 0.000 0.000 ↓ 0.0

Sort (cost=711744.21..711744.55 rows=136 width=136) (actual time=.. rows= loops=)

  • Sort Key: "*SELECT* 1".product_id, "*SELECT* 1".ul_id
17. 0.000 0.000 ↓ 0.0

Result (cost=355867.32..711739.39 rows=136 width=136) (actual time=.. rows= loops=)

18. 0.000 0.000 ↓ 0.0

Append (cost=355867.32..711739.39 rows=136 width=136) (actual time=.. rows= loops=)

19. 0.000 0.000 ↓ 0.0

Subquery Scan on "*SELECT* 1" (cost=355867.32..355869.87 rows=68 width=136) (actual time=.. rows= loops=)

20. 0.000 0.000 ↓ 0.0

HashAggregate (cost=355867.32..355869.19 rows=68 width=32) (actual time=.. rows= loops=)

21. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.00..355858.05 rows=337 width=32) (actual time=.. rows= loops=)

  • Join Filter: (uo.id = sm.product_uom)
22. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.00..355811.44 rows=337 width=27) (actual time=.. rows= loops=)

  • Filter: (NOT (SubPlan 2))
23. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.00..2359.00 rows=674 width=35) (actual time=.. rows= loops=)

24. 0.000 0.000 ↓ 0.0

Seq Scan on stock_move sm (cost=0.00..156.95 rows=674 width=31) (actual time=.. rows= loops=)

  • Filter: ((location_id <> location_dest_id) AND ((state)::text <> 'cancel'::text))
25. 0.000 0.000 ↓ 0.0

Index Scan using stock_location_pkey on stock_location sl (cost=0.00..3.25 rows=1 width=8) (actual time=.. rows= loops=)

  • Index Cond: (id = sm.location_id)
26. 0.000 0.000 ↓ 0.0

Index Scan using stock_warehouse_pkey on stock_warehouse sw (cost=0.00..0.27 rows=1 width=4) (actual time=.. rows= loops=)

  • Index Cond: (id = sl.warehouse_id)
27.          

SubPlan (forNested Loop Left Join)

28. 0.000 0.000 ↓ 0.0

CTE Scan on location l (cost=0.00..1047.67 rows=233 width=4) (actual time=.. rows= loops=)

  • Filter: (id = sm.location_dest_id)
29. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..1.14 rows=9 width=9) (actual time=.. rows= loops=)

30. 0.000 0.000 ↓ 0.0

Seq Scan on product_uom uo (cost=0.00..1.09 rows=9 width=9) (actual time=.. rows= loops=)

31. 0.000 0.000 ↓ 0.0

Subquery Scan on "*SELECT* 2" (cost=355867.32..355869.53 rows=68 width=136) (actual time=.. rows= loops=)

32. 0.000 0.000 ↓ 0.0

HashAggregate (cost=355867.32..355868.85 rows=68 width=32) (actual time=.. rows= loops=)

33. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.00..355858.05 rows=337 width=32) (actual time=.. rows= loops=)

  • Join Filter: (uo.id = sm.product_uom)
34. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.00..355811.44 rows=337 width=27) (actual time=.. rows= loops=)

  • Filter: (NOT (SubPlan 3))
35. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.00..2359.00 rows=674 width=35) (actual time=.. rows= loops=)

36. 0.000 0.000 ↓ 0.0

Seq Scan on stock_move sm (cost=0.00..156.95 rows=674 width=31) (actual time=.. rows= loops=)

  • Filter: ((location_id <> location_dest_id) AND ((state)::text <> 'cancel'::text))
37. 0.000 0.000 ↓ 0.0

Index Scan using stock_location_pkey on stock_location sl (cost=0.00..3.25 rows=1 width=8) (actual time=.. rows= loops=)

  • Index Cond: (id = sm.location_dest_id)
38. 0.000 0.000 ↓ 0.0

Index Scan using stock_warehouse_pkey on stock_warehouse sw (cost=0.00..0.27 rows=1 width=4) (actual time=.. rows= loops=)

  • Index Cond: (id = sl.warehouse_id)
39.          

SubPlan (forNested Loop Left Join)

40. 0.000 0.000 ↓ 0.0

CTE Scan on location l (cost=0.00..1047.67 rows=233 width=4) (actual time=.. rows= loops=)

  • Filter: (id = sm.location_id)
41. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..1.14 rows=9 width=9) (actual time=.. rows= loops=)

42. 0.000 0.000 ↓ 0.0

Seq Scan on product_uom uo (cost=0.00..1.09 rows=9 width=9) (actual time=.. rows= loops=)