Cleanup completed Solid Queue job records

Solid Queue stores completed jobs in the `solid_queue_jobs` table by default. This GitHub issue explains why.

Solid Queue provides a command to clean up the older records to prevent the database size from growing indefinitely.


Steps

1) Define the retention period in the environment config. (Default is 1 day)

config.solid_queue.clear_finished_jobs_after = 1.month

2) Invoke the cleanup command.

> SolidQueue::Job.clear_finished_in_batches

3) Alternatively, it can be scheduled as a recurring task in Solid Queue.

# recurring.yml
production:
  periodic_job_cleanup:
    command: "SolidQueue::Job.clear_finished_in_batches"
    queue: default
    schedule: at 4pm every day

4) Restart Solid Queue.


AI Summary AI Summary
gpt-4.1-2025-04-14 2025-05-15 17:51:40
Solid Queue stores completed job records, which can accumulate and increase database size. To manage this, set a retention period, use provided cleanup commands, and schedule automatic cleanup to regularly remove old records, ensuring efficient database maintenance. Restart Solid Queue after setup.
Chrome On-device AI 2025-06-18 08:47:50
Writing

Share Share this Post