-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possibility of making SolidQueue::Job.clear_finished_in_batches
more performant?
#403
Comments
SolidQueue::Job.clear_finished_in_batches
for performant?SolidQueue::Job.clear_finished_in_batches
more performant?
Hmm... interesting that you get that query. That code results in the following query for us: DELETE FROM `solid_queue_jobs`
WHERE `solid_queue_jobs`.`finished_at` IS NOT NULL
AND `solid_queue_jobs`.`finished_at` < '2024-11-04 19:42:00.055618'
LIMIT 1000; that simply uses the index |
@rosa yes, we're using PostgreSQL |
Ahh, I realised why this is the case. PostgreSQL doesn't support
|
Yes, I believe that's the case - I can't see much of a hit to the performance of our database now, but its a shame that PostgresSQL does it this way |
A postgres approach would be something along the line of:
|
Hey there, I was analyzing some queries that is being done on my solid queue DB and I came across this:
I believe it relates to the
SolidQueue::Job.clear_finished_in_batches
code, where I have been using it like so in a recurring job:I also did an
EXPLAIN QUERY
on this query, and I seems like it's doing a sequential scan on all rows insolid_queue_jobs
which are older than the time specified infinished_before
:More information from query analysis on CloudSQL:
Is it possible to simplify this query, or would there be a timeline for when
clear_finished_jobs_after
will happen automatically?The text was updated successfully, but these errors were encountered: