It reminds me of a good read about optimizing PHP for 1 billion rows challenge. TLDR; at some point you hit a limit in PHP’s stream layer
https://dev.to/realflowcontrol/processing-one-billion-rows-i...