When the concurrency extension looks up for existing queued jobs within the throttle period, it performs the following query :
|
enqueued_within_period = GoodJob::Job.where(concurrency_key: key) |
|
.where(GoodJob::Job.arel_table[:created_at].gt(throttle_period.ago)) |
|
.count |
In my case, this query will run in 200-300ms for each enqueue attempt, so it adds up pretty quickly when trying to enqueue hundreds of jobs.
The index on concurrency_key has a where finished_at is NULL, so it can't be used here.
Would it make sense to have an index solely on concurrency_key ?
Thanks
When the concurrency extension looks up for existing queued jobs within the throttle period, it performs the following query :
good_job/lib/good_job/active_job_extensions/concurrency.rb
Lines 93 to 95 in b557525
In my case, this query will run in 200-300ms for each enqueue attempt, so it adds up pretty quickly when trying to enqueue hundreds of jobs.
The index on
concurrency_keyhas awhere finished_at is NULL, so it can't be used here.Would it make sense to have an index solely on
concurrency_key?Thanks