Skip to content

perf(api): simplify underground trending joins#904

Open
raymondjacobson wants to merge 1 commit into
mainfrom
codex/db-audit-underground-trending-joins
Open

perf(api): simplify underground trending joins#904
raymondjacobson wants to merge 1 commit into
mainfrom
codex/db-audit-underground-trending-joins

Conversation

@raymondjacobson
Copy link
Copy Markdown
Member

Summary

  • removes a non-filtering tracks join from the underground exclusion CTE
  • makes the main tracks and aggregate_user joins explicit inner joins, matching the existing follower/following predicates

Production evidence

  • /v1/tracks/trending/underground was one of the hot trending endpoints in the database audit
  • the old CTE joined tracks with liveness predicates in the ON clause but selected only track_trending_scores.track_id, so deleted/unlisted/unavailable tracks were still counted in the top-20 exclusion set while adding work
  • the main query already rejected NULL aggregate_user rows via aggregate_user.follower_count < 1500 and following_count < 1500, so explicit joins give the planner a simpler join graph with the same endpoint behavior

Verification

  • go test ./api -run 'TestGetTrendingUnderground' -count=1 -timeout=2m

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant