explain.depesz.com

PostgreSQL's explain analyze made readable

Result: S0HB : Optimization for: Optimization for: 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; plan #Mx1H; plan #JKGl5

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 11.139 23.299 ↑ 262.8 60 1

HashAggregate (cost=7,503.86..7,858.68 rows=15,770 width=220) (actual time=23.123..23.299 rows=60 loops=1)

  • Output: pnl.nomenclatureid, pnl.level, 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.nomenclatureid, pnl.level, bsl.bustructureid, bsl.level
  • Buffers: shared hit=8748
2. 0.790 12.160 ↑ 1.0 15,048 1

Hash Join (cost=1,019.83..6,715.36 rows=15,770 width=181) (actual time=1.023..12.160 rows=15,048 loops=1)

  • Output: pnl.nomenclatureid, pnl.level, 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=8748
3. 0.000 11.166 ↓ 1.0 5,016 1

Gather (cost=1,000.72..6,472.11 rows=4,832 width=177) (actual time=0.810..11.166 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.nomenclatureid, pnl.level
  • Workers Planned: 1
  • Workers Launched: 1
  • Buffers: shared hit=8743
4. 8.539 11.526 ↑ 1.1 2,508 2

Nested Loop (cost=0.72..4,988.91 rows=2,842 width=177) (actual time=0.083..11.526 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.nomenclatureid, pnl.level
  • Buffers: shared hit=8743
  • Worker 0: actual time=0.124..16.156 rows=2112 loops=1
  • Buffers: shared hit=3675
5. 0.337 2.968 ↑ 1.2 418 2

Nested Loop (cost=0.28..1,445.15 rows=492 width=169) (actual time=0.036..2.968 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=1183
  • Worker 0: actual time=0.052..3.648 rows=352 loops=1
  • Buffers: shared hit=488
6. 0.973 2.631 ↑ 1.2 418 2

Nested Loop (cost=0.28..1,435.30 rows=492 width=137) (actual time=0.033..2.631 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=1183
  • Worker 0: actual time=0.048..3.374 rows=352 loops=1
  • Buffers: shared hit=488
7. 1.657 1.657 ↑ 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.657 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=1183
  • Worker 0: actual time=0.033..2.558 rows=352 loops=1
  • Buffers: shared hit=488
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.001 rows=1 loops=352
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=352
10. 0.019 0.019 ↑ 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=16) (actual time=0.007..0.019 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.011..0.034 rows=6 loops=352
  • Buffers: shared hit=3187
11. 0.081 0.204 ↓ 1.0 472 1

Hash (cost=13.25..13.25 rows=469 width=12) (actual time=0.204..0.204 rows=472 loops=1)

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

Seq Scan on pricing.bu_structure_link bsl (cost=0.00..13.25 rows=469 width=12) (actual time=0.018..0.123 rows=472 loops=1)

  • Output: 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.616 ms
Execution time : 25.946 ms