explain.depesz.com

PostgreSQL's explain analyze made readable

Result: myxv

Settings
# exclusive inclusive rows x rows loops node
1. 0.087 12,443.300 ↑ 1.0 250 1

Limit (cost=203,834.84..203,835.46 rows=250 width=89) (actual time=12,443.168..12,443.300 rows=250 loops=1)

2.          

CTE hierar

3. 0.117 0.117 ↓ 3.0 3 1

Seq Scan on d_hierarchy_2018_12_19_11_40_44 (cost=0.00..19.04 rows=1 width=7) (actual time=0.013..0.117 rows=3 loops=1)

  • Filter: (((level_03_cd)::text = '153'::text) AND ((sales_segment_cd)::text = ANY ('{100,101,102}'::text[])))
  • Rows Removed by Filter: 430
4. 13.888 12,443.213 ↑ 40.7 250 1

Sort (cost=203,815.80..203,841.26 rows=10,182 width=89) (actual time=12,443.167..12,443.213 rows=250 loops=1)

  • Sort Key: (sum(f_cbus_store_summary_brand_2019_01_08_15_53_18.pod_ty)), s.store_src_cd
  • Sort Method: top-N heapsort Memory: 60kB
5. 56.197 12,429.325 ↓ 2.3 23,165 1

HashAggregate (cost=203,155.71..203,257.53 rows=10,182 width=85) (actual time=12,418.825..12,429.325 rows=23,165 loops=1)

  • Group Key: s.store_src_cd, s.store_cd, s.store_name, s.store_number, s.addr_01_dsc, s.city_dsc, s.state_cd, s.postal_cd, s.unsold
6. 8,711.170 12,373.128 ↓ 2.8 28,232 1

Nested Loop Left Join (cost=469.64..202,901.16 rows=10,182 width=85) (actual time=21.473..12,373.128 rows=28,232 loops=1)

  • Join Filter: ((COALESCE(f_cbus_store_summary_brand_2019_01_08_15_53_18.hier_id, sd.hier_id) = sd.hier_id) AND ((COALESCE(f_cbus_store_summary_brand_2019_01_08_15_53_18.entity_01_cd, sd.entity_01_cd))::text = (sd.entity_01_cd)::text) AND ((COALESCE(f_cbus_store_summary_brand_2019_01_08_15_53_18.brand_cd, sd.brand_cd))::text = (sd.brand_cd)::text) AND ((sd.store_src_cd)::text = (s.store_src_cd)::text))
  • Rows Removed by Join Filter: 18096078
7. 28.961 415.278 ↓ 2.8 28,232 1

Hash Left Join (cost=469.06..202,200.07 rows=10,182 width=100) (actual time=20.198..415.278 rows=28,232 loops=1)

  • Hash Cond: ((s.store_src_cd)::text = (f_cbus_store_summary_brand_2019_01_08_15_53_18.store_src_cd)::text)
8. 14.756 370.246 ↓ 2.3 23,165 1

Nested Loop (cost=379.73..201,843.45 rows=10,182 width=81) (actual time=4.121..370.246 rows=23,165 loops=1)

9. 0.006 0.129 ↑ 1.0 1 1

HashAggregate (cost=0.02..0.03 rows=1 width=78) (actual time=0.128..0.129 rows=1 loops=1)

  • Group Key: (hierar_2.level_04_cd)::text
10. 0.123 0.123 ↓ 3.0 3 1

CTE Scan on hierar hierar_2 (cost=0.00..0.02 rows=1 width=78) (actual time=0.017..0.123 rows=3 loops=1)

11. 50.042 355.361 ↓ 2.3 23,165 1

Bitmap Heap Scan on v_ws_store s (cost=379.70..201,741.60 rows=10,182 width=84) (actual time=3.987..355.361 rows=23,165 loops=1)

  • Recheck Cond: ((market_cd)::text = (hierar_2.level_04_cd)::text)
  • Filter: (SubPlan 2)
  • Rows Removed by Filter: 117
  • Heap Blocks: exact=8444
12. 2.653 2.653 ↓ 1.1 23,407 1

Bitmap Index Scan on v_ws_store_market_cd_idx (cost=0.00..377.16 rows=20,364 width=0) (actual time=2.653..2.653 rows=23,407 loops=1)

  • Index Cond: ((market_cd)::text = (hierar_2.level_04_cd)::text)
13.          

SubPlan (forBitmap Heap Scan)

14. 23.282 302.666 ↑ 1.0 1 23,282

Limit (cost=0.56..8.65 rows=1 width=8) (actual time=0.013..0.013 rows=1 loops=23,282)

15. 279.384 279.384 ↑ 1.0 1 23,282

Index Only Scan using x_store_entity_2018_12_20_02_12_00_pk on x_store_entity_2018_12_20_02_12_00 x_store_entity_2018_12_19_12_36_17 (cost=0.56..8.65 rows=1 width=8) (actual time=0.012..0.012 rows=1 loops=23,282)

  • Index Cond: ((store_src_cd = (s.store_src_cd)::text) AND (opco_cd = '101'::text))
  • Filter: ((entity_01_cd)::text = ANY ('{2224422,2224419,2224418}'::text[]))
  • Rows Removed by Filter: 0
  • Heap Fetches: 4
16. 3.256 16.071 ↓ 434.1 8,248 1

Hash (cost=89.10..89.10 rows=19 width=27) (actual time=16.071..16.071 rows=8,248 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 484kB
17. 3.864 12.815 ↓ 434.1 8,248 1

Nested Loop (cost=0.59..89.10 rows=19 width=27) (actual time=0.139..12.815 rows=8,248 loops=1)

18. 0.004 0.005 ↓ 3.0 3 1

HashAggregate (cost=0.02..0.03 rows=1 width=4) (actual time=0.004..0.005 rows=3 loops=1)

  • Group Key: hierar.hier_id
19. 0.001 0.001 ↓ 3.0 3 1

CTE Scan on hierar (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=3 loops=1)

20. 8.946 8.946 ↓ 144.7 2,749 3

Index Scan using f_cbus_store_summary_brand_2019_01_08_15_53_18_pk on f_cbus_store_summary_brand_2019_01_08_15_53_18 (cost=0.57..88.87 rows=19 width=27) (actual time=0.059..2.982 rows=2,749 loops=3)

  • Index Cond: (((time_period_cd)::text = 'FYTD'::text) AND (hier_id = hierar.hier_id) AND ((brand_cd)::text = '604'::text) AND ((entity_01_cd)::text = ANY ('{2224422,2224419,2224418}'::text[])))
21. 3,246.055 3,246.680 ↓ 213.7 641 28,232

Materialize (cost=0.58..13.82 rows=3 width=24) (actual time=0.000..0.115 rows=641 loops=28,232)

22. 0.263 0.625 ↓ 213.7 641 1

Nested Loop (cost=0.58..13.80 rows=3 width=24) (actual time=0.055..0.625 rows=641 loops=1)

23. 0.005 0.005 ↓ 3.0 3 1

HashAggregate (cost=0.02..0.03 rows=1 width=4) (actual time=0.004..0.005 rows=3 loops=1)

  • Group Key: hierar_1.hier_id
24. 0.000 0.000 ↓ 3.0 3 1

CTE Scan on hierar hierar_1 (cost=0.00..0.02 rows=1 width=4) (actual time=0.000..0.000 rows=3 loops=1)

25. 0.357 0.357 ↓ 71.3 214 3

Index Only Scan using mv_ws_store_brand_last_ship_pk on mv_ws_store_brand_last_ship sd (cost=0.56..13.74 rows=3 width=24) (actual time=0.018..0.119 rows=214 loops=3)

  • Index Cond: ((hier_id = hierar_1.hier_id) AND (brand_cd = '604'::text) AND (entity_01_cd = ANY ('{2224422,2224419,2224418}'::text[])))
  • Heap Fetches: 0