explain.depesz.com

PostgreSQL's explain analyze made readable

Result: DbO0 : Optimization for: plan #hsir

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 7.948 22.335 ↑ 355.8 45 1

HashAggregate (cost=7,526.35..7,886.62 rows=16,012 width=220) (actual time=22.176..22.335 rows=45 loops=1)

  • Output: bsl.bustructureid, bsd.level, pnl.nomenclatureid, pnl.level, sum(psd.marginfrsim), sum(CASE WHEN (purchaseprice1simarray2.simulatedsalesprice IS NOT NULL) THEN CASE WHEN (purchaseprice1simarray2.simulatedsalesprice < purchaseprice1simarray2.initialsalesprice) THEN 1 ELSE 0 END ELSE 0 END), sum(CASE WHEN (salespricesimarray2.simulatedsalesprice IS NOT NULL) THEN CASE WHEN (salespricesimarray2.simulatedsalesprice < salespricesimarray2.initialsalesprice) THEN 1 ELSE 0 END ELSE 0 END), sum(CASE WHEN (purchaseprice1simarray2.simulatedsalesprice IS NOT NULL) THEN CASE WHEN (purchaseprice1simarray2.simulatedsalesprice > purchaseprice1simarray2.initialsalesprice) THEN 1 ELSE 0 END ELSE 0 END), sum(CASE WHEN (salespricesimarray2.simulatedsalesprice IS NOT NULL) THEN CASE WHEN (salespricesimarray2.simulatedsalesprice > salespricesimarray2.initialsalesprice) THEN 1 ELSE 0 END ELSE 0 END), sum(psd.qtysim), sum(psd.revenuesim), sum(psd.revenuefrsim), sum(psd.marginsim), sum((psd.vatamountsim * (psd.qtysim)::numeric))
  • Group Key: bsl.bustructureid, bsd.level, pnl.nomenclatureid, pnl.level
  • Buffers: shared hit=8,751
2. 0.014 14.387 ↑ 1.6 10,032 1

Hash Join (cost=1,027.87..6,725.75 rows=16,012 width=181) (actual time=0.895..14.387 rows=10,032 loops=1)

  • Output: bsl.bustructureid, bsd.level, pnl.nomenclatureid, pnl.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=8,751
3. 1.449 14.104 ↓ 1.0 5,016 1

Gather (cost=1,000.72..6,472.11 rows=4,832 width=177) (actual time=0.618..14.104 rows=5,016 loops=1)

  • Output: psd.marginfrsim, psd.qtysim, psd.revenuesim, psd.revenuefrsim, psd.marginsim, psd.vatamountsim, psd.bustructureid, pnl.nomenclatureid, pnl.level, salespricesimarray2.simulatedsalesprice, salespricesimarray2.initialsalesprice, purchaseprice1simarray2.simulatedsalesprice, purchaseprice1simarray2.initialsalesprice
  • Workers Planned: 1
  • Workers Launched: 1
  • Buffers: shared hit=8,743
4. 0.709 12.655 ↑ 1.1 2,508 2 / 2

Nested Loop (cost=0.72..4,988.91 rows=2,842 width=177) (actual time=0.076..12.655 rows=2,508 loops=2)

  • Output: psd.marginfrsim, psd.qtysim, psd.revenuesim, psd.revenuefrsim, psd.marginsim, psd.vatamountsim, psd.bustructureid, pnl.nomenclatureid, pnl.level, salespricesimarray2.simulatedsalesprice, salespricesimarray2.initialsalesprice, purchaseprice1simarray2.simulatedsalesprice, purchaseprice1simarray2.initialsalesprice
  • Buffers: shared hit=8,743
  • Worker 0: actual time=0.116..15.242 rows=1,896 loops=1
  • Buffers: shared hit=3,311
5. 0.338 3.168 ↑ 1.2 418 2 / 2

Nested Loop (cost=0.28..1,445.15 rows=492 width=169) (actual time=0.034..3.168 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=1,183
  • Worker 0: actual time=0.049..3.482 rows=316 loops=1
  • Buffers: shared hit=459
6. 0.543 2.830 ↑ 1.2 418 2 / 2

Nested Loop (cost=0.28..1,435.30 rows=492 width=137) (actual time=0.031..2.830 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=1,183
  • Worker 0: actual time=0.045..3.234 rows=316 loops=1
  • Buffers: shared hit=459
7. 1.869 1.869 ↑ 1.2 418 2 / 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.019..1.869 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=1,183
  • Worker 0: actual time=0.029..2.480 rows=316 loops=1
  • Buffers: shared hit=459
8. 0.418 0.418 ↑ 1.0 1 836 / 2

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=316
9. 0.000 0.000 ↑ 1.0 1 836 / 2

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=316
10. 8.778 8.778 ↑ 1.0 6 836 / 2

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.008..0.021 rows=6 loops=836)

  • Output: pnl.productid, pnl.nomenclatureid, pnl.level, pnl.nomenclaturecode
  • Index Cond: (pnl.productid = psd.productid)
  • Heap Fetches: 5,016
  • Buffers: shared hit=7,560
  • Worker 0: actual time=0.012..0.036 rows=6 loops=316
  • Buffers: shared hit=2,852
11. 0.041 0.269 ↑ 1.5 314 1

Hash (cost=21.20..21.20 rows=476 width=12) (actual time=0.269..0.269 rows=314 loops=1)

  • Output: bsl.bustructureid, bsl.buid, bsd.level
  • Buckets: 1,024 Batches: 1 Memory Usage: 22kB
  • Buffers: shared hit=8
12. 0.087 0.228 ↑ 1.5 314 1

Hash Join (cost=8.05..21.20 rows=476 width=12) (actual time=0.116..0.228 rows=314 loops=1)

  • Output: bsl.bustructureid, bsl.buid, bsd.level
  • Inner Unique: true
  • Hash Cond: (bsl.bustructureid = bsd.bustructureid)
  • Buffers: shared hit=8
13. 0.074 0.074 ↑ 1.0 473 1

Seq Scan on pricing.bu_structure_link bsl (cost=0.00..11.88 rows=473 width=12) (actual time=0.013..0.074 rows=473 loops=1)

  • Output: bsl.bustructurecode, bsl.bustructureid, bsl.buid, bsl.level, bsl.creationdate, bsl.modificationdate, bsl.suppressiondate
  • Filter: (bsl.bustructurecode = 1)
  • Rows Removed by Filter: 97
  • Buffers: shared hit=5
14. 0.024 0.067 ↓ 1.0 158 1

Hash (cost=6.15..6.15 rows=152 width=12) (actual time=0.067..0.067 rows=158 loops=1)

  • Output: bsd.level, bsd.bustructureid, bsd.bustructurecode
  • Buckets: 1,024 Batches: 1 Memory Usage: 15kB
  • Buffers: shared hit=3
15. 0.043 0.043 ↓ 1.0 158 1

Seq Scan on pricing.bu_structure_detail bsd (cost=0.00..6.15 rows=152 width=12) (actual time=0.007..0.043 rows=158 loops=1)

  • Output: bsd.level, bsd.bustructureid, bsd.bustructurecode
  • Filter: ((bsd.level >= 2) AND (bsd.bustructurecode = 1))
  • Rows Removed by Filter: 59
  • Buffers: shared hit=3
Planning time : 0.861 ms
Execution time : 25.903 ms