spatie/laravel-queued-db-cleanup
Safely delete large numbers of Laravel database records by dispatching non-overlapping queued cleanup jobs. Deletes in small chunks to reduce locks and avoid timeouts, automatically re-dispatching until the query’s records are gone.
Adopt When:
Look Elsewhere If:
TRUNCATE).For Executives: "This package solves a critical scalability bottleneck: safely deleting millions of records without crashing our app or locking tables. It’s like adding a ‘pause’ button for database operations—cleanup runs in the background, so users stay unaffected. For [X] (e.g., GDPR compliance, cost savings), it’s a no-brainer. Low risk (MIT license, battle-tested by Spatie), zero dev overhead, and it future-proofs our data-heavy features."
For Engineering:
"Spatie’s package handles the heavy lifting of chunked, queued deletions—no more manual while loops or race conditions. It’s Laravel-native, integrates with queues (e.g., Redis, database), and includes safeguards for locks/timeouts. We can drop it into any cleanup job in 10 minutes. Tradeoff: async-only, but that’s a feature for our use case. Let’s prototype it for [Y] (e.g., log cleanup) and measure impact on query performance."
How can I help you explore Laravel packages today?