Laravel News
Read post

Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs

Queue-SQL is a Laravel package that solves the problem of long-running mass database writes by splitting large UPDATE, DELETE, and INSERT statements into parallel queued jobs. It works by calculating the min/max primary key range, slicing it into chunks, and dispatching an Illuminate\Bus\Batch to process each slice independently. Key features include a query builder macro with a queue() method, safe SQL compilation to avoid closure serialization issues, flexible batch sizing via chunk or maxJobs, native Laravel Batch support with callbacks, Artisan CLI commands for monitoring and cancellation, and Horizon tagging. A dryRun() method previews the batching plan without dispatching. Compared to Laravel's built-in Prunable trait, Queue-SQL runs concurrently and supports arbitrary updates and bulk inserts. Requires PHP 8.1+, Laravel 10–13, and an integer primary key for range-based chunking.

    #database#php#laravel
Jul 30•5m read time•From laravel-news.com
Post cover image
Table of contents
# Queueing a Write Query# Previewing the Plan# Tracking a Batch from the CLI# Installation & Considerations
94.3K Impressions3 Comments
Laravel News's image
Laravel News

2.2K Followers

•

14.8K Upvotes

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard