You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit aac10a7
Browse filesBrowse the repository at this point in the historyBrowse files
perf: use the build parameter index in GetTemplateParameterInsights (#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 <noreply@anthropic.com>
0 commit comments