Skip to content

perf(db): index for you trending tie order#905

Open
raymondjacobson wants to merge 1 commit into
mainfrom
codex/db-audit-for-you-trending-index
Open

perf(db): index for you trending tie order#905
raymondjacobson wants to merge 1 commit into
mainfrom
codex/db-audit-for-you-trending-index

Conversation

@raymondjacobson
Copy link
Copy Markdown
Member

Summary

  • adds a concurrent partial index for the For You weekly track candidate slice
  • matches the endpoint order exactly: score DESC, track_id DESC
  • leaves the existing partial index in place so this can roll back independently

Production evidence

  • the database audit found the For You weekly trending/underground candidate plan using the existing partial index but still doing an incremental sort for tie ordering
  • api/v1_users_feed_for_you.go orders both cand_trending_track and cand_underground_track by tts.score DESC, tts.track_id DESC
  • the existing idx_track_trending_scores_for_you index is (score DESC, track_id) and cannot satisfy that tie direction directly

Verification

  • migration review only; SQL is CREATE INDEX CONCURRENTLY IF NOT EXISTS plus an index comment
  • no application code changed

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