explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Mx1H : Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: plan #hsir; plan #DbO0; plan #B5ZB; plan #L1As; plan #MgvC; plan #WGY; plan #DIKF; plan #OwqE; plan #zd74; plan #pwV2

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 11.908 24.164 ↑ 262.8 60 1

HashAggregate (cost=7,582.71..7,937.53 rows=15,770 width=228) (actual time=23.987..24.164 rows=60 loops=1)

  • Output: pnl.nomenclaturecode, pnl.nomenclatureid, pnl.level, bsl.bustructurecode, bsl.bustructureid, bsl.level, sum(psd.marginfrsim), count((purchaseprice1simarray2.simulatedsalesprice < purchaseprice1simarray2.initialsalesprice)), count((salespricesimarray2.simulatedsalesprice < salespricesimarray2.initialsalesprice)), count((purchaseprice1simarray2.simulatedsalesprice > purchaseprice1simarray2.initialsalesprice)), count((salespricesimarray2.simulatedsalesprice > salespricesimarray2.initialsalesprice)), sum(psd.qtysim), sum(psd.revenuesim), sum(psd.revenuefrsim), sum(psd.marginsim), sum((psd.vatamountsim * (psd.qtysim)::numeric))
  • Group Key: pnl.nomenclaturecode, pnl.nomenclatureid, pnl.level, bsl.bustructurecode, bsl.bustructureid, bsl.level
  • Buffers: shared hit=8747
2. 0.742 12.256 ↑ 1.0 15,048 1

Hash Join (cost=1,019.83..6,715.36 rows=15,770 width=189) (actual time=0.977..12.256 rows=15,048 loops=1)

  • Output: pnl.nomenclaturecode, pnl.nomenclatureid, pnl.level, bsl.bustructurecode, bsl.bustructureid, bsl.level, psd.marginfrsim, purchaseprice1simarray2.simulatedsalesprice, purchaseprice1simarray2.initialsalesprice, salespricesimarray2.simulatedsalesprice, salespricesimarray2.initialsalesprice, psd.qtysim, psd.revenuesim, psd.revenuefrsim, psd.marginsim, psd.vatamountsim
  • Hash Cond: (psd.bustructureid = bsl.buid)
  • Buffers: shared hit=8747
3. 0.000 11.342 ↓ 1.0 5,016 1

Gather (cost=1,000.72..6,472.11 rows=4,832 width=181) (actual time=0.797..11.342 rows=5,016 loops=1)

  • Output: psd.marginfrsim, psd.qtysim, psd.revenuesim, psd.revenuefrsim, psd.marginsim, psd.vatamountsim, psd.bustructureid, salespricesimarray2.simulatedsalesprice, salespricesimarray2.initialsalesprice, purchaseprice1simarray2.simulatedsalesprice, purchaseprice1simarray2.initialsalesprice, pnl.nomenclaturecode, pnl.nomenclatureid, pnl.level
  • Workers Planned: 1
  • Workers Launched: 1
  • Buffers: shared hit=8742
4. 8.799 12.003 ↑ 1.1 2,508 2

Nested Loop (cost=0.72..4,988.91 rows=2,842 width=181) (actual time=0.083..12.003 rows=2,508 loops=2)

  • Output: psd.marginfrsim, psd.qtysim, psd.revenuesim, psd.revenuefrsim, psd.marginsim, psd.vatamountsim, psd.bustructureid, salespricesimarray2.simulatedsalesprice, salespricesimarray2.initialsalesprice, purchaseprice1simarray2.simulatedsalesprice, purchaseprice1simarray2.initialsalesprice, pnl.nomenclaturecode, pnl.nomenclatureid, pnl.level
  • Buffers: shared hit=8742
  • Worker 0: actual time=0.116..16.865 rows=1938 loops=1
  • Buffers: shared hit=3373
5. 0.351 3.184 ↑ 1.2 418 2

Nested Loop (cost=0.28..1,445.15 rows=492 width=169) (actual time=0.036..3.184 rows=418 loops=2)

  • Output: psd.marginfrsim, psd.qtysim, psd.revenuesim, psd.revenuefrsim, psd.marginsim, psd.vatamountsim, psd.productid, psd.bustructureid, salespricesimarray2.simulatedsalesprice, salespricesimarray2.initialsalesprice, purchaseprice1simarray2.simulatedsalesprice, purchaseprice1simarray2.initialsalesprice
  • Buffers: shared hit=1182
  • Worker 0: actual time=0.051..3.987 rows=323 loops=1
  • Buffers: shared hit=449
6. 1.066 2.833 ↑ 1.2 418 2

Nested Loop (cost=0.28..1,435.30 rows=492 width=137) (actual time=0.033..2.833 rows=418 loops=2)

  • Output: psd.marginfrsim, psd.qtysim, psd.revenuesim, psd.revenuefrsim, psd.marginsim, psd.vatamountsim, psd.purchaseprice1simarray, psd.productid, psd.bustructureid, salespricesimarray2.simulatedsalesprice, salespricesimarray2.initialsalesprice
  • Buffers: shared hit=1182
  • Worker 0: actual time=0.046..3.686 rows=323 loops=1
  • Buffers: shared hit=449
7. 1.766 1.766 ↑ 1.2 418 2

Parallel Index Scan using price_strategy_detail_2094_pk on pricing.price_strategy_detail_2094 psd (cost=0.28..1,425.46 rows=492 width=482) (actual time=0.021..1.766 rows=418 loops=2)

  • Output: psd.productid, psd.bustructureid, psd.nomenclatureid, psd.bulevel, psd.nomenclatureparentid, psd.startpromodate, psd.endpromodate, psd.qtysimarray, psd.qtysim, psd.qty, psd.vatrate, psd.promosalesprice, psd.vatamountsim, psd.vatamount, psd.targetmarginrate, psd.stockqty, psd.marginfrgap, psd.ismodified, psd.ismodifiedfr, psd.margin, psd.marginfr, psd.marginfrrate, psd.marginfrratesim, psd.marginfrsim, psd.margingap, psd.marginrate, psd.marginrategap, psd.marginratesim, psd.marginsim, psd.revenue, psd.revenuefr, psd.revenuefrgap, psd.revenuefrsim, psd.revenuegap, psd.revenuesim, psd.unitmargin, psd.unitmargingap, psd.unitmarginsim, psd.avgcompsalesprice, psd.elasticitycoeff, psd.minsalesprice, psd.maxsalesprice, psd.mincompsalesprice, psd.maxcompsalesprice, psd.oldpurchaseprice2, psd.compnb, psd.oldpurchaseprice, psd.purchaseprice1sim, psd.purchaseprice2, psd.isalignable, psd.iscomp, psd.purchaseprice1, psd.svap, psd.priceindexsim, psd.priceindex, psd.svapfr, psd.analysisaxisarray, psd.detention, psd.salespricegap, psd.purchaseprice1simarray, psd.salesprice, psd.salespricegappct, psd.salespricepromoincl, psd.salespricepromoinclsim, psd.salespricesim, psd.salespricesimarray, psd.databucomparray, psd.databannercomparray, psd.ispricemodifiable, psd.internalarray, psd.pv_hyper, psd.pv_enseigne
  • Filter: (psd.bulevel = 3)
  • Rows Removed by Filter: 238
  • Buffers: shared hit=1182
  • Worker 0: actual time=0.030..2.723 rows=323 loops=1
  • Buffers: shared hit=449
8. 0.001 0.001 ↑ 1.0 1 836

Function Scan on pg_catalog.jsonb_to_record salespricesimarray2 (cost=0.00..0.01 rows=1 width=64) (actual time=0.001..0.001 rows=1 loops=836)

  • Output: salespricesimarray2.simulatedsalesprice, salespricesimarray2.initialsalesprice
  • Function Call: jsonb_to_record((psd.salespricesimarray)[8])
  • Worker 0: actual time=0.001..0.002 rows=1 loops=323
9. 0.000 0.000 ↑ 1.0 1 836

Function Scan on pg_catalog.jsonb_to_record purchaseprice1simarray2 (cost=0.00..0.01 rows=1 width=64) (actual time=0.000..0.000 rows=1 loops=836)

  • Output: purchaseprice1simarray2.simulatedsalesprice, purchaseprice1simarray2.initialsalesprice
  • Function Call: jsonb_to_record((psd.purchaseprice1simarray)[8])
  • Worker 0: actual time=0.000..0.000 rows=1 loops=323
10. 0.020 0.020 ↑ 1.0 6 836

Index Only Scan using product_nomenclature_link_perf_idx on pricing.product_nomenclature_link pnl (cost=0.43..7.14 rows=6 width=20) (actual time=0.007..0.020 rows=6 loops=836)

  • Output: pnl.productid, pnl.nomenclatureid, pnl.level, pnl.nomenclaturecode
  • Index Cond: (pnl.productid = psd.productid)
  • Heap Fetches: 5016
  • Buffers: shared hit=7560
  • Worker 0: actual time=0.013..0.038 rows=6 loops=323
  • Buffers: shared hit=2924
11. 0.067 0.172 ↓ 1.0 472 1

Hash (cost=13.25..13.25 rows=469 width=16) (actual time=0.171..0.172 rows=472 loops=1)

  • Output: bsl.bustructurecode, bsl.bustructureid, bsl.level, bsl.buid
  • Buckets: 1024 Batches: 1 Memory Usage: 31kB
  • Buffers: shared hit=5
12. 0.105 0.105 ↓ 1.0 472 1

Seq Scan on pricing.bu_structure_link bsl (cost=0.00..13.25 rows=469 width=16) (actual time=0.014..0.105 rows=472 loops=1)

  • Output: bsl.bustructurecode, bsl.bustructureid, bsl.level, bsl.buid
  • Filter: ((bsl.level >= 2) AND (bsl.bustructurecode = 1))
  • Rows Removed by Filter: 98
  • Buffers: shared hit=5
Planning time : 0.595 ms
Execution time : 26.799 ms