0031-laravel-data-chunking-large-datasets
CommunityProcess huge datasets without memory spikes
Software Engineering#laravel#batch processing#memory optimization#cursor#data chunking#chunkbyid#lazy collection
AuthorMrJmpl3
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Large Eloquent queries can exhaust memory and degrade performance when you load entire tables at once, especially during exports, migrations, and batch jobs.
Core Features & Use Cases
- Efficient chunking with chunk(): Iterate through records in fixed-size batches for general processing.
- Safer updates with chunkById(): Reduce skipping/duplication risk when modifying rows during iteration by using an ordering column (including custom ID columns).
- Low-memory iteration with lazy() and cursor(): Use generator-backed iteration for forward-only processing and streaming-style workflows.
- Real-world use cases: Export large CSV files, send batch email campaigns, run data migrations, and clean up old records with throttling-friendly patterns.
- Performance guardrails: Select only needed columns, ensure indexes on filter fields, optionally disable Eloquent events, and consider bulk updates and queueing heavy work.
Quick Start
Ask the AI to rewrite your Laravel batch job to use chunkById() for updates and lazy()/cursor() for streaming reads so it can safely handle millions of rows with minimal memory usage.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: 0031-laravel-data-chunking-large-datasets Download link: https://github.com/MrJmpl3/codex_____data_____configuration/archive/main.zip#0031-laravel-data-chunking-large-datasets Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.