explain.depesz.com

PostgreSQL's explain analyze made readable

Result: juJX

Settings
# exclusive inclusive rows x rows loops node
1. 0.088 12,525.519 ↑ 1.0 250 1

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

2.          

CTE hierar

3. 0.107 0.107 ↓ 3.0 3 1

Seq Scan on d_hierarchy_2019_01_09_16_00_43 (cost=0.00..19.04 rows=1 width=7) (actual time=0.014..0.107 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.893 12,525.431 ↑ 40.7 250 1

Sort (cost=203,815.80..203,841.26 rows=10,182 width=89) (actual time=12,525.384..12,525.431 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.247 12,511.538 ↓ 2.3 23,165 1

HashAggregate (cost=203,155.71..203,257.53 rows=10,182 width=85) (actual time=12,500.683..12,511.538 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,783.334 12,455.291 ↓ 2.8 28,232 1

Nested Loop Left Join (cost=469.64..202,901.16 rows=10,182 width=85) (actual time=21.353..12,455.291 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. 30.170 425.277 ↓ 2.8 28,232 1

Hash Left Join (cost=469.06..202,200.07 rows=10,182 width=100) (actual time=20.054..425.277 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. 15.575 379.047 ↓ 2.3 23,165 1

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

9. 0.003 0.117 ↑ 1.0 1 1

HashAggregate (cost=0.02..0.03 rows=1 width=78) (actual time=0.116..0.117 rows=1 loops=1)

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

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

11. 58.127 363.355 ↓ 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.867..363.355 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.562 2.562 ↓ 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.562..2.562 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.300 16.060 ↓ 434.1 8,248 1

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

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

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

18. 0.004 0.007 ↓ 3.0 3 1

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

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

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

20. 8.991 8.991 ↓ 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.997 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.035 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.276 0.645 ↓ 213.7 641 1

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

23. 0.003 0.006 ↓ 3.0 3 1

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

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

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

25. 0.363 0.363 ↓ 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.121 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