Hey 👋
I've been using SolidQueue and Mission Control - Jobs since pretty much the day they came out on my decently sized app. I've accumulated a lot of jobs, but nothing crazy:
visualizer(prod)> SolidQueue::Job.count
=> 1_498_839
However, the more time goes on, the slower Mission Control got. So I decided to have a look and turns out there's this one query that's really slow:

SELECT DISTINCT "solid_queue_jobs"."queue_name" FROM "solid_queue_jobs";
The explain is pretty straight-forward and also it's clear why this would be slow on a large table.
HashAggregate (cost=195015.40..195015.44 rows=4 width=8)
Group Key: queue_name
-> Seq Scan on solid_queue_jobs (cost=0.00..191278.52 rows=1494752 width=8)
JIT:
Functions: 3
Options: Inlining false, Optimization false, Expressions true, Deforming true
I couldn't find any #distinct code in this repo, but I believe the issue starts in ActiveJob::QueueAdapters::SolidQueueExt#queues which calls SolidQueue::Queue.all which does the distinct call.
While I believe the culprit is inside Solid Queue, you have an adapter/extension for it, so maybe the fix should be here? Or maybe the SolidQueue::Queue.all itself should handle queue names better since it could be used by other gems/code.
Luckily both gems have the same maintainers, so I leave the decision to you 😄
Hey 👋
I've been using SolidQueue and Mission Control - Jobs since pretty much the day they came out on my decently sized app. I've accumulated a lot of jobs, but nothing crazy:
However, the more time goes on, the slower Mission Control got. So I decided to have a look and turns out there's this one query that's really slow:
SELECT DISTINCT "solid_queue_jobs"."queue_name" FROM "solid_queue_jobs";The explain is pretty straight-forward and also it's clear why this would be slow on a large table.
I couldn't find any
#distinctcode in this repo, but I believe the issue starts inActiveJob::QueueAdapters::SolidQueueExt#queueswhich callsSolidQueue::Queue.allwhich does the distinct call.While I believe the culprit is inside Solid Queue, you have an adapter/extension for it, so maybe the fix should be here? Or maybe the
SolidQueue::Queue.allitself should handle queue names better since it could be used by other gems/code.Luckily both gems have the same maintainers, so I leave the decision to you 😄