explain.depesz.com

PostgreSQL's explain analyze made readable

Result: eywu

Settings
# exclusive inclusive rows x rows loops node
1. 1.527 1,181.191 ↓ 11.3 2,778 1

GroupAggregate (cost=68,151.10..68,518.94 rows=246 width=16) (actual time=1,154.609..1,181.191 rows=2,778 loops=1)

  • Group Key: "*SELECT* 1".location, "*SELECT* 1".product
2. 0.725 1,179.664 ↓ 2.0 4,929 1

Merge Append (cost=68,151.10..68,498.02 rows=2,461 width=16) (actual time=1,154.603..1,179.664 rows=4,929 loops=1)

  • Sort Key: "*SELECT* 1".location, "*SELECT* 1".product
3. 0.236 862.659 ↓ 1.3 1,497 1

Subquery Scan on *SELECT* 1 (cost=33,836.85..33,992.82 rows=1,192 width=16) (actual time=853.617..862.659 rows=1,497 loops=1)

4. 0.534 862.423 ↓ 1.3 1,497 1

Finalize GroupAggregate (cost=33,836.85..33,980.90 rows=1,192 width=16) (actual time=853.615..862.423 rows=1,497 loops=1)

  • Group Key: "*SELECT* 2_1".to_location, "*SELECT* 2_1".product
5. 20.597 861.889 ↓ 1.5 1,497 1

Gather Merge (cost=33,836.85..33,961.52 rows=994 width=16) (actual time=853.571..861.889 rows=1,497 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
6. 2.127 841.292 ↓ 1.0 499 3 / 3

Partial GroupAggregate (cost=32,836.83..32,846.77 rows=497 width=16) (actual time=838.611..841.292 rows=499 loops=3)

  • Group Key: "*SELECT* 2_1".to_location, "*SELECT* 2_1".product
7. 4.685 839.165 ↓ 17.6 8,736 3 / 3

Sort (cost=32,836.83..32,838.07 rows=497 width=16) (actual time=838.606..839.165 rows=8,736 loops=3)

  • Sort Key: "*SELECT* 2_1".to_location, "*SELECT* 2_1".product
  • Sort Method: quicksort Memory: 1,997kB
  • Worker 0: Sort Method: quicksort Memory: 25kB
  • Worker 1: Sort Method: quicksort Memory: 25kB
8. 8.387 834.480 ↓ 17.6 8,736 3 / 3

Hash Semi Join (cost=11.23..32,814.57 rows=497 width=16) (actual time=556.598..834.480 rows=8,736 loops=3)

  • Hash Cond: ("*SELECT* 2_1".to_location = h.id)
9. 5.926 825.841 ↑ 5.3 44,747 3 / 3

Parallel Append (cost=7.93..32,172.44 rows=238,312 width=16) (actual time=556.144..825.841 rows=44,747 loops=3)

10. 0.001 277.751 ↓ 0.0 0 1 / 3

Subquery Scan on *SELECT* 2_1 (cost=7.93..10,608.98 rows=102,134 width=16) (actual time=833.252..833.252 rows=0 loops=1)

11. 12.108 277.750 ↓ 0.0 0 1 / 3

Hash Left Join (cost=7.93..9,587.64 rows=42,556 width=68) (actual time=833.250..833.250 rows=0 loops=1)

  • Hash Cond: (f.parent = g.id)
  • Filter: (e.flat_childs OR g.flat_childs)
  • Rows Removed by Filter: 134,242
12. 16.965 265.630 ↓ 2.4 134,242 1 / 3

Hash Join (cost=6.06..9,420.63 rows=56,741 width=21) (actual time=0.255..796.891 rows=134,242 loops=1)

  • Hash Cond: (c.to_location = f.id)
13. 15.511 248.650 ↓ 2.4 134,242 1 / 3

Hash Left Join (cost=4.18..9,253.62 rows=56,741 width=17) (actual time=0.190..745.951 rows=134,242 loops=1)

  • Hash Cond: (d.parent = e.id)
14. 20.937 233.126 ↓ 2.4 134,242 1 / 3

Hash Join (cost=2.30..9,086.61 rows=56,741 width=20) (actual time=0.128..699.378 rows=134,242 loops=1)

  • Hash Cond: (c.from_location = d.id)
15. 212.177 212.177 ↓ 2.4 134,242 1 / 3

Parallel Index Scan using "4f0b77cf1bcdbfcdd72857e59db60a2e50535beb47ae07ecfe03356a3cb2b2c" on stock_move c (cost=0.42..8,919.60 rows=56,741 width=20) (actual time=0.070..636.530 rows=134,242 loops=1)

  • Index Cond: (COALESCE(effective_date, planned_date, '9999-12-31'::date) > '2019-07-31'::date)
  • Filter: (((state)::text = ANY ('{done,done}'::text[])) AND (company = 1) AND (((effective_date IS NULL) AND (planned_date <= '2020-07-30'::date)) OR (effective_date <= '2020-07-30'::date) OR ((state)::text = 'assigned'::text)))
  • Rows Removed by Filter: 6,178
16. 0.005 0.012 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=8) (actual time=0.037..0.037 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
17. 0.007 0.007 ↑ 1.0 39 1 / 3

Seq Scan on stock_location d (cost=0.00..1.39 rows=39 width=8) (actual time=0.010..0.022 rows=39 loops=1)

18. 0.007 0.013 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=5) (actual time=0.040..0.040 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
19. 0.007 0.007 ↑ 1.0 39 1 / 3

Seq Scan on stock_location e (cost=0.00..1.39 rows=39 width=5) (actual time=0.006..0.020 rows=39 loops=1)

20. 0.009 0.015 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=8) (actual time=0.044..0.044 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
21. 0.006 0.006 ↑ 1.0 39 1 / 3

Seq Scan on stock_location f (cost=0.00..1.39 rows=39 width=8) (actual time=0.006..0.018 rows=39 loops=1)

22. 0.006 0.012 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=5) (actual time=0.036..0.036 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
23. 0.006 0.006 ↑ 1.0 39 1 / 3

Seq Scan on stock_location g (cost=0.00..1.39 rows=39 width=5) (actual time=0.005..0.019 rows=39 loops=1)

24. 0.002 277.743 ↓ 0.0 0 3 / 3

Subquery Scan on *SELECT* 3_1 (cost=7.93..10,608.98 rows=102,134 width=16) (actual time=277.743..277.743 rows=0 loops=3)

25. 11.675 277.741 ↓ 0.0 0 3 / 3

Hash Left Join (cost=7.93..9,587.64 rows=42,556 width=68) (actual time=277.741..277.741 rows=0 loops=3)

  • Hash Cond: (f_1.parent = g_1.id)
  • Filter: (e_1.flat_childs OR g_1.flat_childs)
  • Rows Removed by Filter: 44,747
26. 16.267 266.054 ↑ 1.3 44,747 3 / 3

Hash Join (cost=6.06..9,420.63 rows=56,741 width=21) (actual time=0.109..266.054 rows=44,747 loops=3)

  • Hash Cond: (c_1.to_location = f_1.id)
27. 14.122 249.756 ↑ 1.3 44,747 3 / 3

Hash Left Join (cost=4.18..9,253.62 rows=56,741 width=17) (actual time=0.059..249.756 rows=44,747 loops=3)

  • Hash Cond: (d_1.parent = e_1.id)
28. 20.315 235.621 ↑ 1.3 44,747 3 / 3

Hash Join (cost=2.30..9,086.61 rows=56,741 width=20) (actual time=0.038..235.621 rows=44,747 loops=3)

  • Hash Cond: (c_1.from_location = d_1.id)
29. 215.294 215.294 ↑ 1.3 44,747 3 / 3

Parallel Index Scan using "4f0b77cf1bcdbfcdd72857e59db60a2e50535beb47ae07ecfe03356a3cb2b2c" on stock_move c_1 (cost=0.42..8,919.60 rows=56,741 width=20) (actual time=0.019..215.294 rows=44,747 loops=3)

  • Index Cond: (COALESCE(effective_date, planned_date, '9999-12-31'::date) > '2019-07-31'::date)
  • Filter: (((state)::text = ANY ('{done,done}'::text[])) AND (company = 1) AND (((effective_date IS NULL) AND (planned_date <= '2020-07-30'::date)) OR (effective_date <= '2020-07-30'::date) OR ((state)::text = 'assigned'::text)))
  • Rows Removed by Filter: 2,059
30. 0.005 0.012 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=8) (actual time=0.036..0.036 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
31. 0.007 0.007 ↑ 1.0 39 1 / 3

Seq Scan on stock_location d_1 (cost=0.00..1.39 rows=39 width=8) (actual time=0.010..0.021 rows=39 loops=1)

32. 0.007 0.013 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=5) (actual time=0.039..0.039 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
33. 0.006 0.006 ↑ 1.0 39 1 / 3

Seq Scan on stock_location e_1 (cost=0.00..1.39 rows=39 width=5) (actual time=0.005..0.019 rows=39 loops=1)

34. 0.012 0.031 ↑ 1.0 39 3 / 3

Hash (cost=1.39..1.39 rows=39 width=8) (actual time=0.031..0.031 rows=39 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
35. 0.019 0.019 ↑ 1.0 39 3 / 3

Seq Scan on stock_location f_1 (cost=0.00..1.39 rows=39 width=8) (actual time=0.011..0.019 rows=39 loops=3)

36. 0.006 0.012 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=5) (actual time=0.035..0.036 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
37. 0.006 0.006 ↑ 1.0 39 1 / 3

Seq Scan on stock_location g_1 (cost=0.00..1.39 rows=39 width=5) (actual time=0.005..0.018 rows=39 loops=1)

38. 10.498 264.421 ↓ 3.9 134,242 1 / 3

Subquery Scan on *SELECT* 1_1 (cost=7.93..9,762.93 rows=34,044 width=16) (actual time=1.992..793.263 rows=134,242 loops=1)

39. 23.303 253.923 ↓ 9.5 134,242 1 / 3

Hash Left Join (cost=7.93..9,422.49 rows=14,185 width=68) (actual time=1.990..761.770 rows=134,242 loops=1)

  • Hash Cond: (f_2.parent = g_2.id)
  • Filter: (NOT COALESCE(g_2.flat_childs, false))
40. 17.327 230.600 ↓ 4.7 134,242 1 / 3

Hash Join (cost=6.06..9,338.05 rows=28,370 width=20) (actual time=1.890..691.799 rows=134,242 loops=1)

  • Hash Cond: (c_2.to_location = f_2.id)
41. 17.343 213.259 ↓ 4.7 134,242 1 / 3

Hash Left Join (cost=4.18..9,253.62 rows=28,370 width=16) (actual time=1.820..639.778 rows=134,242 loops=1)

  • Hash Cond: (d_2.parent = e_2.id)
  • Filter: (NOT COALESCE(e_2.flat_childs, false))
42. 21.001 195.893 ↓ 2.4 134,242 1 / 3

Hash Join (cost=2.30..9,086.61 rows=56,741 width=20) (actual time=1.711..587.679 rows=134,242 loops=1)

  • Hash Cond: (c_2.from_location = d_2.id)
43. 174.869 174.869 ↓ 2.4 134,242 1 / 3

Parallel Index Scan using "4f0b77cf1bcdbfcdd72857e59db60a2e50535beb47ae07ecfe03356a3cb2b2c" on stock_move c_2 (cost=0.42..8,919.60 rows=56,741 width=20) (actual time=1.601..524.606 rows=134,242 loops=1)

  • Index Cond: (COALESCE(effective_date, planned_date, '9999-12-31'::date) > '2019-07-31'::date)
  • Filter: (((state)::text = ANY ('{done,done}'::text[])) AND (company = 1) AND (((effective_date IS NULL) AND (planned_date <= '2020-07-30'::date)) OR (effective_date <= '2020-07-30'::date) OR ((state)::text = 'assigned'::text)))
  • Rows Removed by Filter: 6,178
44. 0.010 0.023 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=8) (actual time=0.069..0.069 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
45. 0.013 0.013 ↑ 1.0 39 1 / 3

Seq Scan on stock_location d_2 (cost=0.00..1.39 rows=39 width=8) (actual time=0.017..0.038 rows=39 loops=1)

46. 0.010 0.023 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=5) (actual time=0.069..0.069 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
47. 0.013 0.013 ↑ 1.0 39 1 / 3

Seq Scan on stock_location e_2 (cost=0.00..1.39 rows=39 width=5) (actual time=0.015..0.040 rows=39 loops=1)

48. 0.007 0.013 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=8) (actual time=0.040..0.040 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
49. 0.006 0.006 ↑ 1.0 39 1 / 3

Seq Scan on stock_location f_2 (cost=0.00..1.39 rows=39 width=8) (actual time=0.007..0.019 rows=39 loops=1)

50. 0.009 0.021 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=5) (actual time=0.063..0.063 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
51. 0.012 0.012 ↑ 1.0 39 1 / 3

Seq Scan on stock_location g_2 (cost=0.00..1.39 rows=39 width=5) (actual time=0.010..0.035 rows=39 loops=1)

52. 0.009 0.252 ↓ 4.0 4 3 / 3

Hash (cost=3.28..3.28 rows=1 width=4) (actual time=0.252..0.252 rows=4 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
53. 0.047 0.243 ↓ 4.0 4 3 / 3

Hash Right Join (cost=1.71..3.28 rows=1 width=4) (actual time=0.234..0.243 rows=4 loops=3)

  • Hash Cond: (i.id = h.parent)
  • Filter: (((h."left" >= 70) AND (h."right" <= 79) AND (NOT i.flat_childs) AND (i.active = ANY ('{t,f}'::boolean[])) AND h.active) OR (h.id = 16))
54. 0.021 0.021 ↑ 1.0 39 3 / 3

Seq Scan on stock_location i (cost=0.00..1.39 rows=39 width=6) (actual time=0.006..0.021 rows=39 loops=3)

55. 0.012 0.175 ↓ 2.0 4 3 / 3

Hash (cost=1.68..1.68 rows=2 width=17) (actual time=0.175..0.175 rows=4 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
56. 0.163 0.163 ↓ 2.0 4 3 / 3

Seq Scan on stock_location h (cost=0.00..1.68 rows=2 width=17) (actual time=0.159..0.163 rows=4 loops=3)

  • Filter: (active AND ((("left" >= 70) AND ("right" <= 79) AND active) OR (id = 16)))
  • Rows Removed by Filter: 35
57. 0.248 295.089 ↓ 1.3 1,539 1

Subquery Scan on *SELECT* 2 (cost=33,836.85..33,995.80 rows=1,192 width=16) (actual time=279.938..295.089 rows=1,539 loops=1)

58. 0.792 294.841 ↓ 1.3 1,539 1

Finalize GroupAggregate (cost=33,836.85..33,983.88 rows=1,192 width=16) (actual time=279.937..294.841 rows=1,539 loops=1)

  • Group Key: "*SELECT* 2_2".from_location, "*SELECT* 2_2".product
59. 17.388 294.049 ↓ 2.4 2,411 1

Gather Merge (cost=33,836.85..33,961.52 rows=994 width=16) (actual time=279.884..294.049 rows=2,411 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
60. 4.527 276.661 ↓ 1.6 804 3 / 3

Partial GroupAggregate (cost=32,836.83..32,846.77 rows=497 width=16) (actual time=270.890..276.661 rows=804 loops=3)

  • Group Key: "*SELECT* 2_2".from_location, "*SELECT* 2_2".product
61. 7.859 272.134 ↓ 37.0 18,408 3 / 3

Sort (cost=32,836.83..32,838.07 rows=497 width=16) (actual time=270.878..272.134 rows=18,408 loops=3)

  • Sort Key: "*SELECT* 2_2".from_location, "*SELECT* 2_2".product
  • Sort Method: quicksort Memory: 3,460kB
  • Worker 0: Sort Method: quicksort Memory: 433kB
  • Worker 1: Sort Method: quicksort Memory: 446kB
62. 8.104 264.275 ↓ 37.0 18,408 3 / 3

Hash Semi Join (cost=11.23..32,814.57 rows=497 width=16) (actual time=157.204..264.275 rows=18,408 loops=3)

  • Hash Cond: ("*SELECT* 2_2".from_location = h_1.id)
63. 4.399 256.107 ↑ 5.3 44,747 3 / 3

Parallel Append (cost=7.93..32,172.44 rows=238,312 width=16) (actual time=157.091..256.107 rows=44,747 loops=3)

64. 0.001 78.467 ↓ 0.0 0 1 / 3

Subquery Scan on *SELECT* 2_2 (cost=7.93..10,608.98 rows=102,134 width=16) (actual time=235.402..235.402 rows=0 loops=1)

65. 8.938 78.466 ↓ 0.0 0 1 / 3

Hash Left Join (cost=7.93..9,587.64 rows=42,556 width=68) (actual time=235.399..235.399 rows=0 loops=1)

  • Hash Cond: (f_3.parent = g_3.id)
  • Filter: (e_3.flat_childs OR g_3.flat_childs)
  • Rows Removed by Filter: 134,242
66. 12.641 69.522 ↓ 2.4 134,242 1 / 3

Hash Join (cost=6.06..9,420.63 rows=56,741 width=25) (actual time=0.115..208.567 rows=134,242 loops=1)

  • Hash Cond: (c_3.to_location = f_3.id)
67. 11.652 56.876 ↓ 2.4 134,242 1 / 3

Hash Left Join (cost=4.18..9,253.62 rows=56,741 width=25) (actual time=0.086..170.628 rows=134,242 loops=1)

  • Hash Cond: (d_3.parent = e_3.id)
68. 15.295 45.217 ↓ 2.4 134,242 1 / 3

Hash Join (cost=2.30..9,086.61 rows=56,741 width=24) (actual time=0.055..135.650 rows=134,242 loops=1)

  • Hash Cond: (c_3.from_location = d_3.id)
69. 29.916 29.916 ↓ 2.4 134,242 1 / 3

Parallel Index Scan using "4f0b77cf1bcdbfcdd72857e59db60a2e50535beb47ae07ecfe03356a3cb2b2c" on stock_move c_3 (cost=0.42..8,919.60 rows=56,741 width=20) (actual time=0.030..89.749 rows=134,242 loops=1)

  • Index Cond: (COALESCE(effective_date, planned_date, '9999-12-31'::date) > '2019-07-31'::date)
  • Filter: (((state)::text = ANY ('{done,done}'::text[])) AND (company = 1) AND (((effective_date IS NULL) AND (planned_date <= '2020-07-30'::date)) OR (effective_date <= '2020-07-30'::date) OR ((state)::text = 'assigned'::text)))
  • Rows Removed by Filter: 6,178
70. 0.002 0.005 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=8) (actual time=0.016..0.016 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
71. 0.003 0.003 ↑ 1.0 39 1 / 3

Seq Scan on stock_location d_3 (cost=0.00..1.39 rows=39 width=8) (actual time=0.003..0.009 rows=39 loops=1)

72. 0.003 0.007 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=5) (actual time=0.021..0.021 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
73. 0.004 0.004 ↑ 1.0 39 1 / 3

Seq Scan on stock_location e_3 (cost=0.00..1.39 rows=39 width=5) (actual time=0.004..0.011 rows=39 loops=1)

74. 0.002 0.005 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=8) (actual time=0.016..0.016 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
75. 0.003 0.003 ↑ 1.0 39 1 / 3

Seq Scan on stock_location f_3 (cost=0.00..1.39 rows=39 width=8) (actual time=0.003..0.009 rows=39 loops=1)

76. 0.003 0.006 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=5) (actual time=0.017..0.017 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
77. 0.003 0.003 ↑ 1.0 39 1 / 3

Seq Scan on stock_location g_3 (cost=0.00..1.39 rows=39 width=5) (actual time=0.002..0.009 rows=39 loops=1)

78. 0.000 78.467 ↓ 0.0 0 1 / 3

Subquery Scan on *SELECT* 3_2 (cost=7.93..10,608.98 rows=102,134 width=16) (actual time=235.400..235.400 rows=0 loops=1)

79. 8.965 78.466 ↓ 0.0 0 1 / 3

Hash Left Join (cost=7.93..9,587.64 rows=42,556 width=68) (actual time=235.399..235.399 rows=0 loops=1)

  • Hash Cond: (f_4.parent = g_4.id)
  • Filter: (e_4.flat_childs OR g_4.flat_childs)
  • Rows Removed by Filter: 134,242
80. 12.338 69.496 ↓ 2.4 134,242 1 / 3

Hash Join (cost=6.06..9,420.63 rows=56,741 width=21) (actual time=0.116..208.488 rows=134,242 loops=1)

  • Hash Cond: (c_4.to_location = f_4.id)
81. 11.258 57.152 ↓ 2.4 134,242 1 / 3

Hash Left Join (cost=4.18..9,253.62 rows=56,741 width=21) (actual time=0.086..171.457 rows=134,242 loops=1)

  • Hash Cond: (d_4.parent = e_4.id)
82. 15.722 45.886 ↓ 2.4 134,242 1 / 3

Hash Join (cost=2.30..9,086.61 rows=56,741 width=24) (actual time=0.052..137.659 rows=134,242 loops=1)

  • Hash Cond: (c_4.from_location = d_4.id)
83. 30.159 30.159 ↓ 2.4 134,242 1 / 3

Parallel Index Scan using "4f0b77cf1bcdbfcdd72857e59db60a2e50535beb47ae07ecfe03356a3cb2b2c" on stock_move c_4 (cost=0.42..8,919.60 rows=56,741 width=20) (actual time=0.027..90.477 rows=134,242 loops=1)

  • Index Cond: (COALESCE(effective_date, planned_date, '9999-12-31'::date) > '2019-07-31'::date)
  • Filter: (((state)::text = ANY ('{done,done}'::text[])) AND (company = 1) AND (((effective_date IS NULL) AND (planned_date <= '2020-07-30'::date)) OR (effective_date <= '2020-07-30'::date) OR ((state)::text = 'assigned'::text)))
  • Rows Removed by Filter: 6,178
84. 0.002 0.005 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=8) (actual time=0.016..0.016 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
85. 0.003 0.003 ↑ 1.0 39 1 / 3

Seq Scan on stock_location d_4 (cost=0.00..1.39 rows=39 width=8) (actual time=0.003..0.009 rows=39 loops=1)

86. 0.005 0.008 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=5) (actual time=0.024..0.025 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
87. 0.004 0.004 ↑ 1.0 39 1 / 3

Seq Scan on stock_location e_4 (cost=0.00..1.39 rows=39 width=5) (actual time=0.004..0.011 rows=39 loops=1)

88. 0.002 0.005 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=8) (actual time=0.016..0.016 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
89. 0.003 0.003 ↑ 1.0 39 1 / 3

Seq Scan on stock_location f_4 (cost=0.00..1.39 rows=39 width=8) (actual time=0.003..0.009 rows=39 loops=1)

90. 0.003 0.006 ↑ 1.0 39 1 / 3

Hash (cost=1.39..1.39 rows=39 width=5) (actual time=0.017..0.017 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
91. 0.003 0.003 ↑ 1.0 39 1 / 3

Seq Scan on stock_location g_4 (cost=0.00..1.39 rows=39 width=5) (actual time=0.002..0.009 rows=39 loops=1)

92. 8.005 94.774 ↓ 1.3 44,747 3 / 3

Subquery Scan on *SELECT* 1_2 (cost=7.93..9,762.93 rows=34,044 width=16) (actual time=0.156..94.774 rows=44,747 loops=3)

93. 17.723 86.769 ↓ 3.2 44,747 3 / 3

Hash Left Join (cost=7.93..9,422.49 rows=14,185 width=68) (actual time=0.155..86.769 rows=44,747 loops=3)

  • Hash Cond: (f_5.parent = g_5.id)
  • Filter: (NOT COALESCE(g_5.flat_childs, false))
94. 12.603 69.029 ↓ 1.6 44,747 3 / 3

Hash Join (cost=6.06..9,338.05 rows=28,370 width=20) (actual time=0.125..69.029 rows=44,747 loops=3)

  • Hash Cond: (c_5.to_location = f_5.id)
95. 12.961 56.400 ↓ 1.6 44,747 3 / 3

Hash Left Join (cost=4.18..9,253.62 rows=28,370 width=20) (actual time=0.075..56.400 rows=44,747 loops=3)

  • Hash Cond: (d_5.parent = e_5.id)
  • Filter: (NOT COALESCE(e_5.flat_childs, false))
96. 15.076 43.421 ↑ 1.3 44,747 3 / 3

Hash Join (cost=2.30..9,086.61 rows=56,741 width=24) (actual time=0.044..43.421 rows=44,747 loops=3)

  • Hash Cond: (c_5.from_location = d_5.id)
97. 28.328 28.328 ↑ 1.3 44,747 3 / 3

Parallel Index Scan using "4f0b77cf1bcdbfcdd72857e59db60a2e50535beb47ae07ecfe03356a3cb2b2c" on stock_move c_5 (cost=0.42..8,919.60 rows=56,741 width=20) (actual time=0.010..28.328 rows=44,747 loops=3)

  • Index Cond: (COALESCE(effective_date, planned_date, '9999-12-31'::date) > '2019-07-31'::date)
  • Filter: (((state)::text = ANY ('{done,done}'::text[])) AND (company = 1) AND (((effective_date IS NULL) AND (planned_date <= '2020-07-30'::date)) OR (effective_date <= '2020-07-30'::date) OR ((state)::text = 'assigned'::text)))
  • Rows Removed by Filter: 2,059
98. 0.009 0.017 ↑ 1.0 39 3 / 3

Hash (cost=1.39..1.39 rows=39 width=8) (actual time=0.017..0.017 rows=39 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
99. 0.008 0.008 ↑ 1.0 39 3 / 3

Seq Scan on stock_location d_5 (cost=0.00..1.39 rows=39 width=8) (actual time=0.003..0.008 rows=39 loops=3)

100. 0.008 0.018 ↑ 1.0 39 3 / 3

Hash (cost=1.39..1.39 rows=39 width=5) (actual time=0.018..0.018 rows=39 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
101. 0.010 0.010 ↑ 1.0 39 3 / 3

Seq Scan on stock_location e_5 (cost=0.00..1.39 rows=39 width=5) (actual time=0.003..0.010 rows=39 loops=3)

102. 0.011 0.026 ↑ 1.0 39 3 / 3

Hash (cost=1.39..1.39 rows=39 width=8) (actual time=0.026..0.026 rows=39 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
103. 0.015 0.015 ↑ 1.0 39 3 / 3

Seq Scan on stock_location f_5 (cost=0.00..1.39 rows=39 width=8) (actual time=0.009..0.015 rows=39 loops=3)

104. 0.008 0.017 ↑ 1.0 39 3 / 3

Hash (cost=1.39..1.39 rows=39 width=5) (actual time=0.017..0.017 rows=39 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
105. 0.009 0.009 ↑ 1.0 39 3 / 3

Seq Scan on stock_location g_5 (cost=0.00..1.39 rows=39 width=5) (actual time=0.003..0.009 rows=39 loops=3)

106. 0.004 0.064 ↓ 4.0 4 3 / 3

Hash (cost=3.28..3.28 rows=1 width=4) (actual time=0.064..0.064 rows=4 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
107. 0.024 0.060 ↓ 4.0 4 3 / 3

Hash Right Join (cost=1.71..3.28 rows=1 width=4) (actual time=0.056..0.060 rows=4 loops=3)

  • Hash Cond: (i_1.id = h_1.parent)
  • Filter: (((h_1."left" >= 70) AND (h_1."right" <= 79) AND (NOT i_1.flat_childs) AND (i_1.active = ANY ('{t,f}'::boolean[])) AND h_1.active) OR (h_1.id = 16))
108. 0.005 0.005 ↑ 1.0 39 3 / 3

Seq Scan on stock_location i_1 (cost=0.00..1.39 rows=39 width=6) (actual time=0.003..0.005 rows=39 loops=3)

109. 0.008 0.031 ↓ 2.0 4 3 / 3

Hash (cost=1.68..1.68 rows=2 width=17) (actual time=0.031..0.031 rows=4 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
110. 0.023 0.023 ↓ 2.0 4 3 / 3

Seq Scan on stock_location h_1 (cost=0.00..1.68 rows=2 width=17) (actual time=0.021..0.023 rows=4 loops=3)

  • Filter: (active AND ((("left" >= 70) AND ("right" <= 79) AND active) OR (id = 16)))
  • Rows Removed by Filter: 35
111. 0.863 21.191 ↓ 24.6 1,893 1

Sort (cost=477.38..477.57 rows=77 width=16) (actual time=21.046..21.191 rows=1,893 loops=1)

  • Sort Key: "*SELECT* 3".location, "*SELECT* 3".product
  • Sort Method: quicksort Memory: 137kB
112. 0.301 20.328 ↓ 24.6 1,893 1

Subquery Scan on *SELECT* 3 (cost=15.54..474.96 rows=77 width=16) (actual time=7.747..20.328 rows=1,893 loops=1)

113. 0.298 20.027 ↓ 24.6 1,893 1

Nested Loop (cost=15.54..474.19 rows=77 width=16) (actual time=7.746..20.027 rows=1,893 loops=1)

114. 0.005 0.061 ↓ 4.0 4 1

HashAggregate (cost=3.29..3.30 rows=1 width=4) (actual time=0.059..0.061 rows=4 loops=1)

  • Group Key: h_2.id
115. 0.027 0.056 ↓ 4.0 4 1

Hash Right Join (cost=1.71..3.28 rows=1 width=4) (actual time=0.051..0.056 rows=4 loops=1)

  • Hash Cond: (i_2.id = h_2.parent)
  • Filter: (((h_2."left" >= 70) AND (h_2."right" <= 79) AND (NOT i_2.flat_childs) AND (i_2.active = ANY ('{t,f}'::boolean[])) AND h_2.active) OR (h_2.id = 16))
116. 0.005 0.005 ↑ 1.0 39 1

Seq Scan on stock_location i_2 (cost=0.00..1.39 rows=39 width=6) (actual time=0.002..0.005 rows=39 loops=1)

117. 0.003 0.024 ↓ 2.0 4 1

Hash (cost=1.68..1.68 rows=2 width=17) (actual time=0.024..0.024 rows=4 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
118. 0.021 0.021 ↓ 2.0 4 1

Seq Scan on stock_location h_2 (cost=0.00..1.68 rows=2 width=17) (actual time=0.019..0.021 rows=4 loops=1)

  • Filter: (active AND ((("left" >= 70) AND ("right" <= 79) AND active) OR (id = 16)))
  • Rows Removed by Filter: 35
119. 0.176 19.668 ↑ 1.1 473 4

Append (cost=12.25..465.52 rows=538 width=16) (actual time=2.139..4.917 rows=473 loops=4)

120. 0.612 2.552 ↑ 1.1 473 4

Bitmap Heap Scan on stock_period_cache k (cost=12.25..110.11 rows=512 width=16) (actual time=0.491..0.638 rows=473 loops=4)

  • Recheck Cond: (location = h_2.id)
  • Filter: (period = 1)
  • Heap Blocks: exact=126
121. 1.940 1.940 ↑ 1.1 473 4

Bitmap Index Scan on stock_period_cache_location_index (cost=0.00..12.12 rows=512 width=0) (actual time=0.485..0.485 rows=473 loops=4)

  • Index Cond: (location = h_2.id)
122. 0.000 16.940 ↓ 0.0 0 4

Subquery Scan on *SELECT* 2_3 (cost=3.52..352.72 rows=26 width=16) (actual time=4.235..4.235 rows=0 loops=4)

  • Filter: (h_2.id = "*SELECT* 2_3".location)
123. 1.932 16.940 ↓ 0.0 0 4

Hash Join (cost=3.52..287.09 rows=5,250 width=20) (actual time=4.235..4.235 rows=0 loops=4)

  • Hash Cond: (l.parent = m.id)
124. 8.668 14.997 ↑ 1.0 10,238 3

Hash Join (cost=1.88..255.65 rows=10,238 width=16) (actual time=0.141..4.999 rows=10,238 loops=3)

  • Hash Cond: (k_1.location = l.id)
125. 6.312 6.312 ↑ 1.0 10,238 3

Seq Scan on stock_period_cache k_1 (cost=0.00..223.98 rows=10,238 width=16) (actual time=0.129..2.104 rows=10,238 loops=3)

  • Filter: (period = 1)
126. 0.008 0.017 ↑ 1.0 39 1

Hash (cost=1.39..1.39 rows=39 width=8) (actual time=0.017..0.017 rows=39 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
127. 0.009 0.009 ↑ 1.0 39 1

Seq Scan on stock_location l (cost=0.00..1.39 rows=39 width=8) (actual time=0.004..0.009 rows=39 loops=1)

128. 0.001 0.011 ↓ 0.0 0 1

Hash (cost=1.39..1.39 rows=20 width=4) (actual time=0.011..0.011 rows=0 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
129. 0.010 0.010 ↓ 0.0 0 1

Seq Scan on stock_location m (cost=0.00..1.39 rows=20 width=4) (actual time=0.010..0.010 rows=0 loops=1)

  • Filter: flat_childs
  • Rows Removed by Filter: 39