Magento, Laravel, Eloquent.
better to stick to chunk. option 3: Using chunkById // when using eloquent $products = Products::chunkById(100, function($products){ foreach ($products as $product){ // Process products } }); // when using query builder $products = DB::table('products')->chunkById(100, function ($products){ foreach