Skip to content

perf(coderd/database): optimize GetWorkspaceAgentAndLatestBuildByAuthToken #12809

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

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Mar 28, 2024

This query is run 35k/hour on dev.coder.com, this refactor lowers the execution time from 10ms to <0.2ms in my testing (against dev.coder.com DB) and should result in a bit less load.

Original: https://explain.dalibo.com/plan/ggdbc4b4dbeg6b1c
New: https://explain.dalibo.com/plan/ee87631976a2dh62

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @mafredri and the rest of your teammates on Graphite Graphite

@mafredri mafredri marked this pull request as ready for review March 28, 2024 17:31
@mafredri mafredri requested review from f0ssel and johnstcn March 28, 2024 17:31
Copy link
Member

@kylecarbs kylecarbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omg

Copy link
Contributor

@f0ssel f0ssel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I welcome any optimizations of my mediocre queries with open arms, thanks so much for finding and doing this.

@mafredri mafredri merged commit 79441e3 into main Mar 28, 2024
@mafredri mafredri deleted the mafredri/03-28-perf_coderd_database_optimize_getworkspaceagentandlatestbuildbyauthtoken_ branch March 28, 2024 17:38
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2024
@mafredri
Copy link
Member Author

It would seem this was a success:

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants