Skip to content

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Sep 22, 2025

This commit creates a composite index on (priority DESC, id ASC) to improve performance of job selection queries that order by priority and id for queue processing.

This improved the job selection query performance from roughly 800ms to 0.07ms after enqueuing all of the analyze-crate-file backfill background jobs.


Without the index, the background worker got increasingly faster the less jobs were in the database:

grafik

With this index we should have seen a mostly linear graph.

@Turbo87 Turbo87 added C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works A-backend ⚙️ labels Sep 22, 2025
@Turbo87 Turbo87 force-pushed the background-job-index branch from ec362bd to 412f4ae Compare September 22, 2025 09:50
This commit creates a composite index on `(priority DESC, id ASC)` to improve performance of job selection queries that order by priority and id for queue processing.

This improved the job selection query performance from roughly 800ms to 0.07ms after enqueuing all of the `analyze-crate-file` backfill background jobs.
@Turbo87 Turbo87 force-pushed the background-job-index branch from 412f4ae to 4632343 Compare September 22, 2025 11:03
@Turbo87 Turbo87 enabled auto-merge (squash) September 22, 2025 11:08
@Turbo87 Turbo87 merged commit 0238722 into rust-lang:main Sep 22, 2025
10 checks passed
@Turbo87 Turbo87 deleted the background-job-index branch September 22, 2025 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-backend ⚙️ C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant