explain.depesz.com

PostgreSQL's explain analyze made readable

Result: IOaY

Settings
# exclusive inclusive rows x rows loops node
1. 0.088 139.468 ↑ 1.0 250 1

Limit (cost=28,056.24..28,056.86 rows=250 width=89) (actual time=139.336..139.468 rows=250 loops=1)

2.          

CTE hierar

3. 0.119 0.119 ↓ 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.018..0.119 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. 14.040 139.380 ↑ 81.5 250 1

Sort (cost=28,037.20..28,088.11 rows=20,364 width=89) (actual time=139.334..139.380 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. 35.746 125.340 ↓ 1.1 23,282 1

HashAggregate (cost=26,717.02..26,920.66 rows=20,364 width=85) (actual time=116.963..125.340 rows=23,282 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. 14.372 89.594 ↓ 1.4 28,460 1

Hash Left Join (cost=26,017.29..26,207.92 rows=20,364 width=85) (actual time=45.501..89.594 rows=28,460 loops=1)

  • Hash Cond: ((s.store_src_cd)::text = (sd.store_src_cd)::text)
  • 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))
  • Rows Removed by Join Filter: 641
7. 16.003 74.380 ↓ 1.4 28,460 1

Hash Right Join (cost=26,003.44..26,092.24 rows=20,364 width=100) (actual time=44.644..74.380 rows=28,460 loops=1)

  • Hash Cond: ((f_cbus_store_summary_brand_2019_01_08_15_53_18.store_src_cd)::text = (s.store_src_cd)::text)
8. 3.946 13.899 ↓ 434.1 8,248 1

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

9. 0.007 0.008 ↓ 3.0 3 1

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

  • Group Key: hierar.hier_id
10. 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)

11. 9.945 9.945 ↓ 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.061..3.315 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[])))
12. 13.291 44.478 ↓ 1.1 23,282 1

Hash (cost=25,748.30..25,748.30 rows=20,364 width=81) (actual time=44.478..44.478 rows=23,282 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 2633kB
13. 13.281 31.187 ↓ 1.1 23,282 1

Nested Loop (cost=382.27..25,748.30 rows=20,364 width=81) (actual time=4.162..31.187 rows=23,282 loops=1)

14. 0.006 0.130 ↑ 1.0 1 1

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

  • Group Key: (hierar_2.level_04_cd)::text
15. 0.124 0.124 ↓ 3.0 3 1

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

16. 15.032 17.776 ↓ 1.1 23,282 1

Bitmap Heap Scan on v_ws_store s (cost=382.25..25,544.63 rows=20,364 width=84) (actual time=4.029..17.776 rows=23,282 loops=1)

  • Recheck Cond: ((market_cd)::text = (hierar_2.level_04_cd)::text)
  • Heap Blocks: exact=8444
17. 2.744 2.744 ↓ 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.744..2.744 rows=23,407 loops=1)

  • Index Cond: ((market_cd)::text = (hierar_2.level_04_cd)::text)
18. 0.260 0.842 ↓ 213.7 641 1

Hash (cost=13.80..13.80 rows=3 width=24) (actual time=0.842..0.842 rows=641 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 36kB
19. 0.243 0.582 ↓ 213.7 641 1

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

20. 0.004 0.006 ↓ 3.0 3 1

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

  • Group Key: hierar_1.hier_id
21. 0.002 0.002 ↓ 3.0 3 1

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

22. 0.333 0.333 ↓ 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.111 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