Performant BOM explosion
Rene Zwanenburg
renezwanenburg at gmail.com
Mon Apr 14 14:30:33 UTC 2025
On Monday, 14 April 2025 at 11:45:19 UTC, Lars Johansson wrote:
> I would be very obliged if anyone can advise a way to create
> the complete BOM tree.
I would:
- Order by parent ID when selecting from the parent-child table
- Use chunkBy() to group the children per-parent
- Then use map() + assocArray() to turn it into an AA. Depending
on how your SQL library works it might be important to copy the
children to a new dynamic array here.
That will give you an AA that can be used to recursively walk
through the BOM with decent enough performance.
More information about the Digitalmars-d-learn
mailing list