GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — perf(webapp): look up environments by indexed organization column by claude[bot] · Pull Request #4477 · triggerdotdev/trigger.dev

Conversation

@claude

@claude claude Bot commented Aug 2, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Requested via Slack thread

Before: the metric endpoint built its environment field mappings by asking for every environment whose project belongs to the organization. Filtering through the project relation forces a join against the projects table, and it happened on every single request.

After: the same lookup filters on the environment's own organization column, which is indexed. It returns exactly the same set of environments with less work per request. This endpoint is polled frequently by the dashboard charts, so it runs often and the saving adds up.

How

RuntimeEnvironment already carries its own non-nullable organizationId column with an index on it, and that column is always populated with the same organization as the environment's project — every creation path (project setup, per-member development environments, preview branches) sets both from the same source, and nothing reassigns a project between organizations. So where: { project: { organizationId } } and where: { organizationId } select identical rows.

The change swaps one for the other. No extra predicates were added — neither the old nor the new filter applies any archived/deleted condition, so behaviour is unchanged. The neighbouring project lookup already filters on its column directly and was left alone.


Testing

Webapp typecheck passes. The change is a one-line filter swap on a read query with no behavioural difference: both filters resolve to the same set of environments, and the surrounding mapping code is untouched.


Changelog

Dashboard charts load with less database work behind the scenes.


Screenshots

No UI change.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@claude
perf(webapp): look up environments by indexed organization column
86e4c08
The metric endpoint built its environment field mappings with a
`where: { project: { organizationId } }` filter, which joins through the
projects table on every request. RuntimeEnvironment has its own non-null,
indexed organizationId column that is always set to the same organization
as the environment's project, so filter on it directly instead.

Returns the same set of environments with less work per request.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01B6byUe71HjFpnGAsicw7Hy
@changeset-bot

changeset-bot Bot commented Aug 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 86e4c08

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@claude
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.