Skip to content

perf: investigate N+1 query duplication across API handlers #1214

@johnstcn

Description

@johnstcn

While investigating a separate issue, @dannykopping noticed that the /api/v2/workspaceagents/:id handler has a bit of an N+1 query issue.

From the trace:

Image

We can see a number of duplicated queries in the trace:

  • GetWorkspaceByID
  • GetWorkspaceBuildByJobID
  • GetProvisionerJobByID
    etc.

We should only need to call any of the given DB queries once per endpoint invocation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions