Repository navigation
Fork Sync Branch 19.0 - #31
Merged
Merged
Conversation
The query that picks the next job filtered bg_job by state with no index, so it read the whole table on every call, even with nothing in the queue. Its cost grew with the history of finished jobs, which was never deleted. - Add a partial index on (priority, create_date, id) for enqueued jobs. It serves _get_next_job and _has_eligible_jobs. - Delete finished jobs after a retention period, in an autovacuum that works in committed batches of 10000: done and canceled after 30 days, failed after 90 (base_bg.done_retention_days and base_bg.failed_retention_days, 0 keeps them forever). The first run clears the existing backlog batch by batch. - Index next_job_id: without it, deleting each job scanned the table to clear the self-referencing foreign key. closes #506 Signed-off-by: Nicolas Mac Rouillon <nmr@adhoc.inc>
sireko
approved these changes
Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.