Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- The For You feed orders weekly track candidates by score DESC, track_id DESC.
-- The older partial index uses track_id ascending, leaving PostgreSQL to do an
-- incremental sort after the index scan. Match the API order exactly.

create index concurrently if not exists idx_track_trending_scores_for_you_desc_tiebreak
on track_trending_scores (score desc, track_id desc)
where type = 'TRACKS'
and version = 'pnagD'
and time_range = 'week'
and (genre is null or genre = '');

comment on index idx_track_trending_scores_for_you_desc_tiebreak is
'Partial index matching For You feed weekly track candidate ordering by score desc, track_id desc.';
Loading