---
title: Cleanup completed Solid Queue job records
url: https://calvin.my/posts/cleanup-completed-solid-queue-job-records
published: 2025-05-15
updated: 2026-09-14
category: Operations
tags:
- Rails
- Solid Queue
- Job
- Ruby
summary: Solid Queue retains completed job records by default, which can cause database growth over time. The post outlines setting a retention period, with one day as the default, then running the built-in batch cleanup operation to remove older finished jobs. Cleanup can also be scheduled as a recurring Solid Queue task for ongoing maintenance. Restarting Solid Queue applies the updated configuration.
---

# Cleanup completed Solid Queue job records

Solid Queue stores completed jobs in the \`solid\_queue\_jobs\` table by default. This GitHub [issue](https://github.com/rails/solid_queue/issues/560#issuecomment-2867614167) 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)

```ruby
config.solid_queue.clear_finished_jobs_after = 1.month
```

2. Invoke the cleanup command.

```ruby
> SolidQueue::Job.clear_finished_in_batches
```

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

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

4. Restart Solid Queue.
