Repository navigation
perf: use the build parameter index in GetTemplateParameterInsights (#31765) - #32006
Merged
Merged
Conversation
Contributor
|
👋 Hey @coder-backporter-app[bot]! This PR is targeting the Only bug fixes should be cherry-picked to release branches. If this is a bug fix, please update the PR title to match the conventional commit format: If this is not a bug fix, it likely should not target a release branch. |
…31765) Speeds up `GetTemplateParameterInsights`, which the insights collector runs every 5 minutes on every replica. The `@>` array join could only hash on `name`, so every run scanned all of `workspace_build_parameters`. Unnesting the build IDs and joining on `(workspace_build_id, name)` lets the existing unique index serve it, and the results don't change since each build ID shows up at most once per group. On 8.4M synthetic build parameters the collector's 5 minute window went from 5,193 ms to about 31 ms. `TestGetTemplateParameterInsights` is new and passes on both the old and new SQL. This also fixes the Prometheus docs example, which summed per-replica copies of the same metric. I split the `workspace_app_stats` index into #31766 so this one has no migration and can be backported to 2.34 through 2.39 (2.34 to 2.38 without the docs hunk). Part of [CORE-439](https://linear.app/codercom/issue/CORE-439). (cherry picked from commit 3728e7a) The docs hunk is dropped on this branch because its Prometheus docs have no example query; only the generated metrics table. Co-Authored-By: Claude Opus 5.5 <[email protected]>
denisra
approved these changes
Nov 24, 2026
denisra
had a problem deploying
to
docs-preview
November 24, 2026 09:19 — with
GitHub Actions
Failure
This branch had an error being deployed
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.
Backport of #31765
Original PR: #31765 — perf: use the build parameter index in GetTemplateParameterInsights
Merge commit: 3728e7a
Requested by: @dylanhuff-at-coder
Resolved the conflicts by hand. I dropped the docs hunk since this branch's Prometheus docs have no example query, and kept only the new
TestGetTemplateParameterInsightsfromquerier_test.go.TestGetTemplateParameterInsightsand thecoderdinsights tests pass locally onrelease/2.34.