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
  1. Invoke the cleanup command.
> SolidQueue::Job.clear_finished_in_batches
  1. 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
  1. Restart Solid Queue.