Skip to content

fix(labrinth): reduce rows returned by project query - #7901

Merged
mergify[bot] merged 1 commit into
mainfrom
fetch/project-query
Oct 9, 2026
Merged

mergify[bot] merged 1 commit into
mainfrom
fetch/project-query

Conversation

@fetchfern

@fetchfern fetchfern commented Oct 8, 2026 •

Copy link
Copy Markdown
Member
  • This query is used to get all aggregated version fields for a project.
  • The current query's DISTINCT doesn't actually deduplicate anything. It returns number of projects * versions per project * fields per version rows.
  • All these rows are never deduplicated, even in code. aggregate_version_fields in ProjectQueryResult ends up storing all fields for every version, which is then cached on Redis. For projects with 1000+ versions that's megabytes of data.
  • Anywhere in Labrinth that fetches project info pays that cost.

The new query doesn't group by version ID, so duplicate rows are never fetched. The query plan is basically the same, only the amount of rows returned is reduced.

MIN(vf.version_id) isn't strictly necessary here but the type used (VersionField) actually needs a version ID field for other purposes. We could use a different type eventually but that's a bigger change. Loader fields will soon be removed anyways

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Pull request changelog

App

Added

Changed

Deprecated

Removed

Fixed

Security

Website

Added

Changed

Deprecated

Removed

Fixed

Security

Hosting

Added

Changed

Deprecated

Removed

Fixed

Security

@aecsocket

Copy link
Copy Markdown
Contributor

@Mergifyio queue

@mergify

mergify Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Merge Queue Status

This pull request spent 13 minutes 26 seconds in the queue, including 13 minutes running CI.

Required conditions to merge

@mergify mergify Bot added the queued label Oct 9, 2026
@mergify mergify Bot mentioned this pull request Oct 9, 2026
6 of 10 tasks
@mergify
mergify Bot merged commit d994f0a into main Oct 9, 2026
11 checks passed
@mergify
mergify Bot deleted the fetch/project-query branch October 9, 2026 08:16
@mergify mergify Bot removed the queued label Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants