Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Conversation

@mafredri
Copy link
Member

@mafredrimafredri commentedSep 4, 2025
edited
Loading

Fixescoder/internal#724

This change adds an index to optimize theGetProvisionerDaemonsWithStatusByOrganization query.

On dogfood, this index does not add a lot of weight to the database and reduces execution time.

coder=> \di+ provisioner_jobs_worker_id_organization_id_completed_at_idxList of relations-[ RECORD 1 ]-+------------------------------------------------------------Schema        | publicName          | provisioner_jobs_worker_id_organization_id_completed_at_idxType          | indexOwner         | coderTable         | provisioner_jobsPersistence   | permanentAccess method | btreeSize          | 4720 kBDescription   |

@mafredrimafredri changed the titlefix(coderd/database): optimize GetProvisionerDaemonsWithStatusByOrganization query via indexfix(coderd/database): optimize provisioner daemon with status query via indexSep 4, 2025
@mafredrimafredri changed the titlefix(coderd/database): optimize provisioner daemon with status query via indexfix(coderd/database): optimize provisioner daemon with status query using indexSep 4, 2025
@mafredrimafredri marked this pull request as ready for reviewSeptember 4, 2025 13:25
Copy link
Member

@johnstcnjohnstcn left a 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 @@
CREATEINDEXprovisioner_jobs_worker_id_organization_id_completed_at_idxON provisioner_jobs (worker_id, organization_id, completed_atDESC NULLS FIRST);
Copy link
Member

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?

Copy link
MemberAuthor

@mafredrimafredriSep 4, 2025
edited
Loading

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.

@mafredrimafredri merged commit9db265d intomainSep 8, 2025
45 of 48 checks passed
@mafredrimafredri deleted the mafredri/fix-optimize-provisioner-daemon-with-status-query branchSeptember 8, 2025 08:10
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsSep 8, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

@deansheatherdeansheatherdeansheather approved these changes

@spikecurtisspikecurtisAwaiting requested review from spikecurtis

Assignees

@mafredrimafredri

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

bug: GetProvisionerDaemonsWithStatusByOrganization is slow and creates lots of DB load

4 participants

@mafredri@johnstcn@deansheather

[8]ページ先頭

©2009-2025 Movatter.jp