- Notifications
You must be signed in to change notification settings - Fork1k
fix(coderd/database): optimize provisioner daemon with status query using index#19703
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
fix(coderd/database): optimize provisioner daemon with status query using index#19703
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…ization query via indexFixescoder/internal#724
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Missing amake gen
but otherwise nice add!
@@ -0,0 +1,3 @@ | |||
CREATE INDEX provisioner_jobs_worker_id_organization_id_completed_at_idx ON provisioner_jobs (worker_id, organization_id, completed_at DESC NULLS FIRST); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
What impact didNULLS FIRST
show versus without in your testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It's negligible because there are 0 uncompleted jobs in the clone I have. It does get rid of one sort, and should provide a benefit for larger datasets and lots of in flight jobs.
9db265d
intomainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Fixescoder/internal#724
This change adds an index to optimize the
GetProvisionerDaemonsWithStatusByOrganization
query.On dogfood, this index does not add a lot of weight to the database and reduces execution time.
18s 838ms
=>107ms
.