explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 5zfq : sample

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 3.183 2,026.845 ↑ 22.6 680 1

GroupAggregate (cost=65,349.53..66,576.81 rows=15,341 width=304) (actual time=2,023.571..2,026.845 rows=680 loops=1)

  • Output: $0, $1, $2, $3, $4, $5, $6, t.name, s.name, p.name, sum(((((((((CASE WHEN (v7.volume IS NULL) THEN 0.00 ELSE v7.volume END + CASE WHEN (v6.volume IS NULL) THEN 0.00 ELSE v6.volume END) + CASE WHEN (v5.volume IS NULL) THEN 0.00 ELSE v5.volume END) + CASE WHEN (v4.volume IS NULL) THEN 0.00 ELSE v4.volume END) + CASE WHEN (v3.volume IS NULL) THEN 0.00 ELSE v3.volume END) + CASE WHEN (v2.volume IS NULL) THEN 0.00 ELSE v2.volume END) + CASE WHEN (v1.volume IS NULL) THEN 0.00 ELSE v1.volume END) + CASE WHEN (v.volume IS NULL) THEN 0.00 ELSE v.volume END) / '8'::numeric)), sum(((((CASE WHEN (v3.volume IS NULL) THEN 0.00 ELSE v3.volume END + CASE WHEN (v2.volume IS NULL) THEN 0.00 ELSE v2.volume END) + CASE WHEN (v1.volume IS NULL) THEN 0.00 ELSE v1.volume END) + CASE WHEN (v.volume IS NULL) THEN 0.00 ELSE v.volume END) / '4'::numeric)), sum(CASE WHEN (v3.volume IS NULL) THEN 0.00 ELSE v3.volume END), sum(CASE WHEN (v2.volume IS NULL) THEN 0.00 ELSE v2.volume END), sum(CASE WHEN (v1.volume IS NULL) THEN 0.00 ELSE v1.volume END), sum(CASE WHEN (v.volume IS NULL) THEN 0.00 ELSE v.volume END)
  • Group Key: t.name, s.name, p.name
  • Buffers: shared hit=446441
2.          

Initplan (forGroupAggregate)

3. 0.008 0.008 ↑ 1.0 1 1

Function Scan on bvr_get_first_day_of_week (cost=0.00..0.01 rows=1 width=4) (actual time=0.008..0.008 rows=1 loops=1)

  • Output: bvr_get_first_day_of_week.bvr_get_first_day_of_week
  • Function Call: '2016-11-14'::date
4. 0.001 0.001 ↑ 1.0 1 1

Function Scan on bvr_get_first_day_of_week_1 (cost=0.00..0.01 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

  • Output: bvr_get_first_day_of_week_1.bvr_get_first_day_of_week
  • Function Call: '2016-12-12'::date
5. 0.001 0.001 ↑ 1.0 1 1

Function Scan on bvr_get_last_day_of_week (cost=0.00..0.01 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

  • Output: bvr_get_last_day_of_week.bvr_get_last_day_of_week
  • Function Call: '2016-12-18'::date
6. 0.002 0.002 ↑ 1.0 1 1

Function Scan on bvr_get_first_day_of_week_2 (cost=0.00..0.01 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=1)

  • Output: bvr_get_first_day_of_week_2.bvr_get_first_day_of_week
  • Function Call: '2016-12-19'::date
7. 0.002 0.002 ↑ 1.0 1 1

Function Scan on bvr_get_last_day_of_week_1 (cost=0.00..0.01 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=1)

  • Output: bvr_get_last_day_of_week_1.bvr_get_last_day_of_week
  • Function Call: '2016-12-25'::date
8. 0.001 0.001 ↑ 1.0 1 1

Function Scan on bvr_get_first_day_of_week_3 (cost=0.00..0.01 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

  • Output: bvr_get_first_day_of_week_3.bvr_get_first_day_of_week
  • Function Call: '2016-12-26'::date
9. 0.001 0.001 ↑ 1.0 1 1

Function Scan on bvr_get_last_day_of_week_2 (cost=0.00..0.01 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

  • Output: bvr_get_last_day_of_week_2.bvr_get_last_day_of_week
  • Function Call: '2017-01-01'::date
10. 0.004 0.004 ↑ 1.0 1 1

Function Scan on bvr_get_first_day_of_week_4 (cost=0.00..0.01 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=1)

  • Output: bvr_get_first_day_of_week_4.bvr_get_first_day_of_week
  • Function Call: '2016-12-26'::date
11. 0.001 0.001 ↑ 1.0 1 1

Function Scan on bvr_get_last_day_of_week_3 (cost=0.00..0.01 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

  • Output: bvr_get_last_day_of_week_3.bvr_get_last_day_of_week
  • Function Call: '2017-01-01'::date
12. 0.007 0.007 ↑ 1.0 1 1

Function Scan on bvr_get_first_day_of_week_5 (cost=0.00..0.01 rows=1 width=4) (actual time=0.007..0.007 rows=1 loops=1)

  • Output: bvr_get_first_day_of_week_5.bvr_get_first_day_of_week
  • Function Call: '2016-12-19'::date
13. 0.002 0.002 ↑ 1.0 1 1

Function Scan on bvr_get_last_day_of_week_4 (cost=0.00..0.01 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=1)

  • Output: bvr_get_last_day_of_week_4.bvr_get_last_day_of_week
  • Function Call: '2016-12-25'::date
14. 0.004 0.004 ↑ 1.0 1 1

Function Scan on bvr_get_first_day_of_week_6 (cost=0.00..0.01 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=1)

  • Output: bvr_get_first_day_of_week_6.bvr_get_first_day_of_week
  • Function Call: '2016-12-12'::date
15. 0.001 0.001 ↑ 1.0 1 1

Function Scan on bvr_get_last_day_of_week_5 (cost=0.00..0.01 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

  • Output: bvr_get_last_day_of_week_5.bvr_get_last_day_of_week
  • Function Call: '2016-12-18'::date
16. 0.004 0.004 ↑ 1.0 1 1

Function Scan on bvr_get_first_day_of_week_7 (cost=0.00..0.01 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=1)

  • Output: bvr_get_first_day_of_week_7.bvr_get_first_day_of_week
  • Function Call: '2016-12-05'::date
17. 0.001 0.001 ↑ 1.0 1 1

Function Scan on bvr_get_last_day_of_week_6 (cost=0.00..0.01 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

  • Output: bvr_get_last_day_of_week_6.bvr_get_last_day_of_week
  • Function Call: '2016-12-11'::date
18. 0.004 0.004 ↑ 1.0 1 1

Function Scan on bvr_get_first_day_of_week_8 (cost=0.00..0.01 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=1)

  • Output: bvr_get_first_day_of_week_8.bvr_get_first_day_of_week
  • Function Call: '2016-11-28'::date
19. 0.002 0.002 ↑ 1.0 1 1

Function Scan on bvr_get_last_day_of_week_7 (cost=0.00..0.01 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=1)

  • Output: bvr_get_last_day_of_week_7.bvr_get_last_day_of_week
  • Function Call: '2016-12-04'::date
20. 0.005 0.005 ↑ 1.0 1 1

Function Scan on bvr_get_first_day_of_week_9 (cost=0.00..0.01 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=1)

  • Output: bvr_get_first_day_of_week_9.bvr_get_first_day_of_week
  • Function Call: '2016-11-21'::date
21. 0.001 0.001 ↑ 1.0 1 1

Function Scan on bvr_get_last_day_of_week_8 (cost=0.00..0.01 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

  • Output: bvr_get_last_day_of_week_8.bvr_get_last_day_of_week
  • Function Call: '2016-11-27'::date
22. 0.005 0.005 ↑ 1.0 1 1

Function Scan on bvr_get_first_day_of_week_10 (cost=0.00..0.01 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=1)

  • Output: bvr_get_first_day_of_week_10.bvr_get_first_day_of_week
  • Function Call: '2016-11-14'::date
23. 0.002 0.002 ↑ 1.0 1 1

Function Scan on bvr_get_last_day_of_week_9 (cost=0.00..0.01 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=1)

  • Output: bvr_get_last_day_of_week_9.bvr_get_last_day_of_week
  • Function Call: '2016-11-20'::date
24. 2.660 2,023.603 ↑ 19.7 779 1

Sort (cost=65,349.32..65,387.67 rows=15,341 width=340) (actual time=2,023.508..2,023.603 rows=779 loops=1)

  • Output: t.name, s.name, p.name, v7.volume, v6.volume, v5.volume, v4.volume, v3.volume, v2.volume, v1.volume, v.volume
  • Sort Key: t.name, s.name, p.name
  • Sort Method: quicksort Memory: 202kB
  • Buffers: shared hit=446441
25. 17.405 2,020.943 ↑ 19.7 779 1

Nested Loop (cost=915.74..64,282.73 rows=15,341 width=340) (actual time=1,973.274..2,020.943 rows=779 loops=1)

  • Output: t.name, s.name, p.name, v7.volume, v6.volume, v5.volume, v4.volume, v3.volume, v2.volume, v1.volume, v.volume
  • Join Filter: (((v.zon)::text = (s.c_salesregion_id)::text) OR ((v1.zon)::text = (s.c_salesregion_id)::text) OR ((v2.zon)::text = (s.c_salesregion_id)::text) OR ((v3.zon)::text = (s.c_salesregion_id)::text) OR ((v4.zon)::text = (s.c_salesregion_id)::text) OR ((v5.zon)::text = (s.c_salesregion_id)::text) OR ((v6.zon)::text = (s.c_salesregion_id)::text) OR ((v7.zon)::text = (s.c_salesregion_id)::text))
  • Rows Removed by Join Filter: 35055
  • Buffers: shared hit=446441
26. 1.283 2,001.980 ↑ 10.9 779 1

Nested Loop (cost=915.74..51,590.75 rows=8,487 width=569) (actual time=1,973.218..2,001.980 rows=779 loops=1)

  • Output: v.volume, v.zon, v1.volume, v1.zon, v2.volume, v2.zon, v3.volume, v3.zon, v4.volume, v4.zon, v5.volume, v5.zon, v6.volume, v6.zon, v7.volume, v7.zon, t.name, p.name
  • Buffers: shared hit=446438
27. 10.028 1,985.896 ↑ 1.4 779 1

Nested Loop (cost=871.10..1,766.19 rows=1,061 width=796) (actual time=1,973.166..1,985.896 rows=779 loops=1)

  • Output: v.volume, v.idprod, v.zon, v1.volume, v1.idprod, v1.zon, v2.volume, v2.idprod, v2.zon, v3.volume, v3.idprod, v3.zon, v4.volume, v4.idprod, v4.zon, v5.volume, v5.idprod, v5.zon, v6.volume, v6.idprod, v6.zon, v7.volume, v7.idprod, v7.zon, t.name
  • Join Filter: (((v.territ)::text = (t.pm_territorial_id)::text) OR ((v1.territ)::text = (t.pm_territorial_id)::text) OR ((v2.territ)::text = (t.pm_territorial_id)::text) OR ((v3.territ)::text = (t.pm_territorial_id)::text) OR ((v4.territ)::text = (t.pm_territorial_id)::text) OR ((v5.territ)::text = (t.pm_territorial_id)::text) OR ((v6.territ)::text = (t.pm_territorial_id)::text) OR ((v7.territ)::text = (t.pm_territorial_id)::text))
  • Rows Removed by Join Filter: 20254
  • Buffers: shared hit=431160
28. 0.836 1,974.310 ↑ 1.3 779 1

Merge Full Join (cost=871.10..886.35 rows=1,000 width=1,024) (actual time=1,973.132..1,974.310 rows=779 loops=1)

  • Output: v.volume, v.idprod, v.zon, v.territ, v1.volume, v1.idprod, v1.zon, v1.territ, v2.volume, v2.idprod, v2.zon, v2.territ, v3.volume, v3.idprod, v3.zon, v3.territ, v4.volume, v4.idprod, v4.zon, v4.territ, v5.volume, v5.idprod, v5.zon, v5.territ, v6.volume, v6.idprod, v6.zon, v6.territ, v7.volume, v7.idprod, v7.zon, v7.territ
  • Merge Cond: (((v6.idprod)::text = (v7.idprod)::text) AND ((v6.zon)::text = (v7.zon)::text))
  • Buffers: shared hit=431158
29. 2.338 1,712.911 ↑ 1.3 772 1

Sort (cost=811.03..813.53 rows=1,000 width=896) (actual time=1,712.694..1,712.911 rows=772 loops=1)

  • Output: v.volume, v.idprod, v.zon, v.territ, v1.volume, v1.idprod, v1.zon, v1.territ, v2.volume, v2.idprod, v2.zon, v2.territ, v3.volume, v3.idprod, v3.zon, v3.territ, v4.volume, v4.idprod, v4.zon, v4.territ, v5.volume, v5.idprod, v5.zon, v5.territ, v6.volume, v6.idprod, v6.zon, v6.territ
  • Sort Key: v6.idprod, v6.zon
  • Sort Method: quicksort Memory: 649kB
  • Buffers: shared hit=376742
30. 0.642 1,710.573 ↑ 1.3 772 1

Merge Full Join (cost=745.95..761.20 rows=1,000 width=896) (actual time=1,709.764..1,710.573 rows=772 loops=1)

  • Output: v.volume, v.idprod, v.zon, v.territ, v1.volume, v1.idprod, v1.zon, v1.territ, v2.volume, v2.idprod, v2.zon, v2.territ, v3.volume, v3.idprod, v3.zon, v3.territ, v4.volume, v4.idprod, v4.zon, v4.territ, v5.volume, v5.idprod, v5.zon, v5.territ, v6.volume, v6.idprod, v6.zon, v6.territ
  • Merge Cond: (((v5.idprod)::text = (v6.idprod)::text) AND ((v5.zon)::text = (v6.zon)::text))
  • Buffers: shared hit=376742
31. 1.842 1,457.205 ↑ 1.3 758 1

Sort (cost=685.87..688.37 rows=1,000 width=768) (actual time=1,457.085..1,457.205 rows=758 loops=1)

  • Output: v.volume, v.idprod, v.zon, v.territ, v1.volume, v1.idprod, v1.zon, v1.territ, v2.volume, v2.idprod, v2.zon, v2.territ, v3.volume, v3.idprod, v3.zon, v3.territ, v4.volume, v4.idprod, v4.zon, v4.territ, v5.volume, v5.idprod, v5.zon, v5.territ
  • Sort Key: v5.idprod, v5.zon
  • Sort Method: quicksort Memory: 625kB
  • Buffers: shared hit=321734
32. 0.605 1,455.363 ↑ 1.3 758 1

Merge Full Join (cost=620.79..636.04 rows=1,000 width=768) (actual time=1,454.597..1,455.363 rows=758 loops=1)

  • Output: v.volume, v.idprod, v.zon, v.territ, v1.volume, v1.idprod, v1.zon, v1.territ, v2.volume, v2.idprod, v2.zon, v2.territ, v3.volume, v3.idprod, v3.zon, v3.territ, v4.volume, v4.idprod, v4.zon, v4.territ, v5.volume, v5.idprod, v5.zon, v5.territ
  • Merge Cond: (((v4.idprod)::text = (v5.idprod)::text) AND ((v4.zon)::text = (v5.zon)::text))
  • Buffers: shared hit=321734
33. 1.727 1,211.875 ↑ 1.4 727 1

Sort (cost=560.71..563.21 rows=1,000 width=640) (actual time=1,211.767..1,211.875 rows=727 loops=1)

  • Output: v.volume, v.idprod, v.zon, v.territ, v1.volume, v1.idprod, v1.zon, v1.territ, v2.volume, v2.idprod, v2.zon, v2.territ, v3.volume, v3.idprod, v3.zon, v3.territ, v4.volume, v4.idprod, v4.zon, v4.territ
  • Sort Key: v4.idprod, v4.zon
  • Sort Method: quicksort Memory: 560kB
  • Buffers: shared hit=267589
34. 0.552 1,210.148 ↑ 1.4 727 1

Merge Full Join (cost=495.63..510.88 rows=1,000 width=640) (actual time=1,209.434..1,210.148 rows=727 loops=1)

  • Output: v.volume, v.idprod, v.zon, v.territ, v1.volume, v1.idprod, v1.zon, v1.territ, v2.volume, v2.idprod, v2.zon, v2.territ, v3.volume, v3.idprod, v3.zon, v3.territ, v4.volume, v4.idprod, v4.zon, v4.territ
  • Merge Cond: (((v3.idprod)::text = (v4.idprod)::text) AND ((v3.zon)::text = (v4.zon)::text))
  • Buffers: shared hit=267589
35. 1.519 971.473 ↑ 1.5 666 1

Sort (cost=435.55..438.05 rows=1,000 width=512) (actual time=971.367..971.473 rows=666 loops=1)

  • Output: v.volume, v.idprod, v.zon, v.territ, v1.volume, v1.idprod, v1.zon, v1.territ, v2.volume, v2.idprod, v2.zon, v2.territ, v3.volume, v3.idprod, v3.zon, v3.territ
  • Sort Key: v3.idprod, v3.zon
  • Sort Method: quicksort Memory: 329kB
  • Buffers: shared hit=214135
36. 0.507 969.954 ↑ 1.5 666 1

Merge Full Join (cost=370.47..385.72 rows=1,000 width=512) (actual time=969.331..969.954 rows=666 loops=1)

  • Output: v.volume, v.idprod, v.zon, v.territ, v1.volume, v1.idprod, v1.zon, v1.territ, v2.volume, v2.idprod, v2.zon, v2.territ, v3.volume, v3.idprod, v3.zon, v3.territ
  • Merge Cond: (((v2.idprod)::text = (v3.idprod)::text) AND ((v2.zon)::text = (v3.zon)::text))
  • Buffers: shared hit=214135
37. 1.082 731.192 ↑ 1.6 625 1

Sort (cost=310.39..312.89 rows=1,000 width=384) (actual time=731.120..731.192 rows=625 loops=1)

  • Output: v.volume, v.idprod, v.zon, v.territ, v1.volume, v1.idprod, v1.zon, v1.territ, v2.volume, v2.idprod, v2.zon, v2.territ
  • Sort Key: v2.idprod, v2.zon
  • Sort Method: quicksort Memory: 294kB
  • Buffers: shared hit=160511
38. 0.482 730.110 ↑ 1.6 625 1

Merge Full Join (cost=245.32..260.57 rows=1,000 width=384) (actual time=729.523..730.110 rows=625 loops=1)

  • Output: v.volume, v.idprod, v.zon, v.territ, v1.volume, v1.idprod, v1.zon, v1.territ, v2.volume, v2.idprod, v2.zon, v2.territ
  • Merge Cond: (((v1.idprod)::text = (v2.idprod)::text) AND ((v1.zon)::text = (v2.zon)::text))
  • Buffers: shared hit=160511
39. 1.769 483.179 ↑ 1.7 602 1

Sort (cost=185.24..187.74 rows=1,000 width=256) (actual time=483.119..483.179 rows=602 loops=1)

  • Output: v.volume, v.idprod, v.zon, v.territ, v1.volume, v1.idprod, v1.zon, v1.territ
  • Sort Key: v1.idprod, v1.zon
  • Sort Method: quicksort Memory: 165kB
  • Buffers: shared hit=106119
40. 0.699 481.410 ↑ 1.7 602 1

Merge Full Join (cost=120.16..135.41 rows=1,000 width=256) (actual time=480.519..481.410 rows=602 loops=1)

  • Output: v.volume, v.idprod, v.zon, v.territ, v1.volume, v1.idprod, v1.zon, v1.territ
  • Merge Cond: (((v.idprod)::text = (v1.idprod)::text) AND ((v.zon)::text = (v1.zon)::text))
  • Buffers: shared hit=106119
41. 0.681 171.176 ↑ 2.2 452 1

Sort (cost=60.08..62.58 rows=1,000 width=128) (actual time=171.068..171.176 rows=452 loops=1)

  • Output: v.volume, v.idprod, v.zon, v.territ
  • Sort Key: v.idprod, v.zon
  • Sort Method: quicksort Memory: 88kB
  • Buffers: shared hit=41345
42. 170.495 170.495 ↑ 2.2 452 1

Function Scan on public.bvr_net_sales_by_terr_zone v (cost=0.25..10.25 rows=1,000 width=128) (actual time=170.433..170.495 rows=452 loops=1)

  • Output: v.volume, v.idprod, v.zon, v.territ
  • Function Call: bvr_net_sales_by_terr_zone('2017-01-02'::date, '2017-01-06'::date, NULL::character varying, NULL::character varying)
  • Buffers: shared hit=41345
43. 1.263 309.535 ↑ 1.7 598 1

Sort (cost=60.08..62.58 rows=1,000 width=128) (actual time=309.443..309.535 rows=598 loops=1)

  • Output: v1.volume, v1.idprod, v1.zon, v1.territ
  • Sort Key: v1.idprod, v1.zon
  • Sort Method: quicksort Memory: 109kB
  • Buffers: shared hit=64774
44. 308.272 308.272 ↑ 1.7 598 1

Function Scan on public.bvr_net_sales_by_terr_zone v1 (cost=0.25..10.25 rows=1,000 width=128) (actual time=308.207..308.272 rows=598 loops=1)

  • Output: v1.volume, v1.idprod, v1.zon, v1.territ
  • Function Call: bvr_net_sales_by_terr_zone($7, $8, NULL::character varying, NULL::character varying)
  • Buffers: shared hit=64774
45. 0.830 246.449 ↑ 1.8 571 1

Sort (cost=60.08..62.58 rows=1,000 width=128) (actual time=246.398..246.449 rows=571 loops=1)

  • Output: v2.volume, v2.idprod, v2.zon, v2.territ
  • Sort Key: v2.idprod, v2.zon
  • Sort Method: quicksort Memory: 105kB
  • Buffers: shared hit=54392
46. 245.619 245.619 ↑ 1.8 571 1

Function Scan on public.bvr_net_sales_by_terr_zone v2 (cost=0.25..10.25 rows=1,000 width=128) (actual time=245.541..245.619 rows=571 loops=1)

  • Output: v2.volume, v2.idprod, v2.zon, v2.territ
  • Function Call: bvr_net_sales_by_terr_zone($9, $10, NULL::character varying, NULL::character varying)
  • Buffers: shared hit=54392
47. 0.830 238.255 ↑ 1.7 588 1

Sort (cost=60.08..62.58 rows=1,000 width=128) (actual time=238.205..238.255 rows=588 loops=1)

  • Output: v3.volume, v3.idprod, v3.zon, v3.territ
  • Sort Key: v3.idprod, v3.zon
  • Sort Method: quicksort Memory: 107kB
  • Buffers: shared hit=53624
48. 237.425 237.425 ↑ 1.7 588 1

Function Scan on public.bvr_net_sales_by_terr_zone v3 (cost=0.25..10.25 rows=1,000 width=128) (actual time=237.350..237.425 rows=588 loops=1)

  • Output: v3.volume, v3.idprod, v3.zon, v3.territ
  • Function Call: bvr_net_sales_by_terr_zone($11, $12, NULL::character varying, NULL::character varying)
  • Buffers: shared hit=53624
49. 0.974 238.123 ↑ 1.6 632 1

Sort (cost=60.08..62.58 rows=1,000 width=128) (actual time=238.059..238.123 rows=632 loops=1)

  • Output: v4.volume, v4.idprod, v4.zon, v4.territ
  • Sort Key: v4.idprod, v4.zon
  • Sort Method: quicksort Memory: 113kB
  • Buffers: shared hit=53454
50. 237.149 237.149 ↑ 1.6 632 1

Function Scan on public.bvr_net_sales_by_terr_zone v4 (cost=0.25..10.25 rows=1,000 width=128) (actual time=237.066..237.149 rows=632 loops=1)

  • Output: v4.volume, v4.idprod, v4.zon, v4.territ
  • Function Call: bvr_net_sales_by_terr_zone($13, $14, NULL::character varying, NULL::character varying)
  • Buffers: shared hit=53454
51. 0.959 242.883 ↑ 1.5 650 1

Sort (cost=60.08..62.58 rows=1,000 width=128) (actual time=242.824..242.883 rows=650 loops=1)

  • Output: v5.volume, v5.idprod, v5.zon, v5.territ
  • Sort Key: v5.idprod, v5.zon
  • Sort Method: quicksort Memory: 116kB
  • Buffers: shared hit=54145
52. 241.924 241.924 ↑ 1.5 650 1

Function Scan on public.bvr_net_sales_by_terr_zone v5 (cost=0.25..10.25 rows=1,000 width=128) (actual time=241.845..241.924 rows=650 loops=1)

  • Output: v5.volume, v5.idprod, v5.zon, v5.territ
  • Function Call: bvr_net_sales_by_terr_zone($15, $16, NULL::character varying, NULL::character varying)
  • Buffers: shared hit=54145
53. 0.923 252.726 ↑ 1.6 641 1

Sort (cost=60.08..62.58 rows=1,000 width=128) (actual time=252.672..252.726 rows=641 loops=1)

  • Output: v6.volume, v6.idprod, v6.zon, v6.territ
  • Sort Key: v6.idprod, v6.zon
  • Sort Method: quicksort Memory: 115kB
  • Buffers: shared hit=55008
54. 251.803 251.803 ↑ 1.6 641 1

Function Scan on public.bvr_net_sales_by_terr_zone v6 (cost=0.25..10.25 rows=1,000 width=128) (actual time=251.732..251.803 rows=641 loops=1)

  • Output: v6.volume, v6.idprod, v6.zon, v6.territ
  • Function Call: bvr_net_sales_by_terr_zone($17, $18, NULL::character varying, NULL::character varying)
  • Buffers: shared hit=55008
55. 1.027 260.563 ↑ 1.6 626 1

Sort (cost=60.08..62.58 rows=1,000 width=128) (actual time=260.431..260.563 rows=626 loops=1)

  • Output: v7.volume, v7.idprod, v7.zon, v7.territ
  • Sort Key: v7.idprod, v7.zon
  • Sort Method: quicksort Memory: 113kB
  • Buffers: shared hit=54416
56. 259.536 259.536 ↑ 1.6 626 1

Function Scan on public.bvr_net_sales_by_terr_zone v7 (cost=0.25..10.25 rows=1,000 width=128) (actual time=259.447..259.536 rows=626 loops=1)

  • Output: v7.volume, v7.idprod, v7.zon, v7.territ
  • Function Call: bvr_net_sales_by_terr_zone($19, $20, NULL::character varying, NULL::character varying)
  • Buffers: shared hit=54416
57. 1.536 1.558 ↑ 1.0 27 779

Materialize (cost=0.00..2.41 rows=27 width=61) (actual time=0.000..0.002 rows=27 loops=779)

  • Output: t.name, t.pm_territorial_id
  • Buffers: shared hit=2
58. 0.022 0.022 ↑ 1.0 27 1

Seq Scan on public.pm_territorial t (cost=0.00..2.27 rows=27 width=61) (actual time=0.012..0.022 rows=27 loops=1)

  • Output: t.name, t.pm_territorial_id
  • Buffers: shared hit=2
59. 0.779 14.801 ↑ 8.0 1 779

Bitmap Heap Scan on public.m_product p (cost=44.64..46.88 rows=8 width=62) (actual time=0.019..0.019 rows=1 loops=779)

  • Output: p.m_product_id, p.ad_client_id, p.ad_org_id, p.isactive, p.created, p.createdby, p.updated, p.updatedby, p.value, p.name, p.description, p.documentnote, p.help, p.upc, p.sku, p.c_uom_id, p.salesrep_id, p.issummary, p.isstocked, p.ispurchased, p.issold, p.isbom, p.isinvoiceprintdetails, p.ispicklistprintdetails, p.isverified, p.m_product_category_id, p.classification, p.volume, p.weight, p.shelfwidth, p.shelfheight, p.shelfdepth, p.unitsperpallet, p.c_taxcategory_id, p.s_resource_id, p.discontinued, p.discontinuedby, p.processing, p.s_expensetype_id, p.producttype, p.imageurl, p.descriptionurl, p.guaranteedays, p.versionno, p.m_attributeset_id, p.m_attributesetinstance_id, p.downloadurl, p.m_freightcategory_id, p.m_locator_id, p.ad_image_id, p.c_bpartner_id, p.ispriceprinted, p.name2, p.costtype, p.coststd, p.stock_min, p.enforce_attribute, p.calculated, p.ma_processplan_id, p.production, p.capacity, p.delaymin, p.mrp_planner_id, p.mrp_planningmethod_id, p.qtymax, p.qtymin, p.qtystd, p.qtytype, p.stockmin, p.attrsetvaluetype, p.em_ci_isimportcost, p.em_pm_hebracost, p.em_pm_restcost, p.em_pm_standarcost, p.em_pm_internalproduct, p.em_pm_ishebra, p.em_pm_blacktobacco, p.em_pm_segment, p.em_pm_class, p.em_pm_origin, p.em_pm_hebraclass, p.em_pm_filter, p.em_pm_trademark, p.em_pm_trademarkversion, p.em_pm_classpack, p.em_pm_numberofcigarretes, p.em_pm_economiclot, p.em_pm_taxpercent, p.em_pm_taxitem, p.em_pm_priority, p.em_pm_materialtype, p.em_pm_hebrapercent, p.em_pm_lenght, p.em_pm_lenghttobaccobar, p.em_pm_circle, p.em_pm_filterplugsize, p.em_pm_punterawidth, p.em_pm_totalweight, p.em_pm_barweight, p.em_pm_netweight, p.em_pm_density, p.em_pm_tipventilation, p.em_pm_sobreventilation, p.em_pm_maxstock, p.em_pm_finalcustomeramt, p.em_pm_royalty, p.em_pm_subclass_id, p.em_pm_boxgrossweight, p.em_pm_boxnetweight, p.em_pm_vdvalue, p.em_pm_vendorproductno, p.em_pm_findvendorproduct, p.em_pm_checkmin, p.em_pm_cpcu, p.em_br_boxes, p.em_br_parlets, p.em_sh_productmerma, p.em_ta_type_id, p.em_cuvddm_tpvcode, p.em_cuvddm_tpvname, p.em_cuvddm_invoiceorderno, p.em_cuvddm_pickingorderno, p.em_cuvddm_barcode, p.em_cuvddm_tpvorderno, p.em_cuvddm_vdname, p.em_cuvddm_insert_invdplist, p.em_vd_isvd, p.em_launch, p.em_smfpda_order, p.em_smfpda_ismerch, p.em_smfpda_qtyinpack
  • Recheck Cond: (((v.idprod)::text = (p.m_product_id)::text) OR ((v1.idprod)::text = (p.m_product_id)::text) OR ((v2.idprod)::text = (p.m_product_id)::text) OR ((v3.idprod)::text = (p.m_product_id)::text) OR ((v4.idprod)::text = (p.m_product_id)::text) OR ((v5.idprod)::text = (p.m_product_id)::text) OR ((v6.idprod)::text = (p.m_product_id)::text) OR ((v7.idprod)::text = (p.m_product_id)::text))
  • Heap Blocks: exact=779
  • Buffers: shared hit=15278
60. 1.558 14.022 ↓ 0.0 0 779

BitmapOr (cost=44.64..44.64 rows=8 width=0) (actual time=0.018..0.018 rows=0 loops=779)

  • Buffers: shared hit=14499
  • Buffers: shared hit=1926
61. 1.558 1.558 ↑ 1.0 1 779

Bitmap Index Scan on m_product_key (cost=0.00..0.61 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=779)

  • Index Cond: ((v.idprod)::text = (p.m_product_id)::text)
  • Buffers: shared hit=1374
62. 1.558 1.558 ↑ 1.0 1 779

Bitmap Index Scan on m_product_key (cost=0.00..0.61 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=779)

  • Index Cond: ((v1.idprod)::text = (p.m_product_id)::text)
  • Buffers: shared hit=1824
63. 1.558 1.558 ↑ 1.0 1 779

Bitmap Index Scan on m_product_key (cost=0.00..0.61 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=779)

  • Index Cond: ((v2.idprod)::text = (p.m_product_id)::text)
  • Buffers: shared hit=1738
64. 1.558 1.558 ↑ 1.0 1 779

Bitmap Index Scan on m_product_key (cost=0.00..0.61 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=779)

  • Index Cond: ((v3.idprod)::text = (p.m_product_id)::text)
  • Buffers: shared hit=1795
65. 1.558 1.558 ↑ 1.0 1 779

Bitmap Index Scan on m_product_key (cost=0.00..0.61 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=779)

  • Index Cond: ((v4.idprod)::text = (p.m_product_id)::text)
66. 1.558 1.558 ↑ 1.0 1 779

Bitmap Index Scan on m_product_key (cost=0.00..0.61 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=779)

  • Index Cond: ((v5.idprod)::text = (p.m_product_id)::text)
  • Buffers: shared hit=1980
67. 1.558 1.558 ↑ 1.0 1 779

Bitmap Index Scan on m_product_key (cost=0.00..0.61 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=779)

  • Index Cond: ((v6.idprod)::text = (p.m_product_id)::text)
  • Buffers: shared hit=1954
68. 1.558 1.558 ↑ 1.0 1 779

Bitmap Index Scan on m_product_key (cost=0.00..0.61 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=779)

  • Index Cond: ((v7.idprod)::text = (p.m_product_id)::text)
  • Buffers: shared hit=1908
69. 1.537 1.558 ↑ 1.0 46 779

Materialize (cost=0.00..4.03 rows=46 width=60) (actual time=0.000..0.002 rows=46 loops=779)

  • Output: s.name, s.c_salesregion_id
  • Buffers: shared hit=3
70. 0.021 0.021 ↑ 1.0 46 1

Seq Scan on public.c_salesregion s (cost=0.00..3.80 rows=46 width=60) (actual time=0.007..0.021 rows=46 loops=1)

  • Output: s.name, s.c_salesregion_id
  • Filter: ((s.em_smfpda_rolepda)::text = ANY ('{CDF6A8F3D620493BAF5E70A4971A8D4E,27513ED9D4FC40189BFCCF754C3A9318,57E79DBE08284174B3D97E10C18B9B24}'::text[]))
  • Rows Removed by Filter: 12
  • Buffers: shared hit=3