fix: distinguish a title collision from an attribution miss, and index for it #8

Merged
lyrathorpe merged 1 commits from fix/title-collisions-and-index into main 2026-08-24 17:37:12 +01:00
Owner

Two faults, both visible in the first real run

The split was measuring the wrong thing

It reported 700 pairs / 2851 plays as attribution disagreements, on the strength
of the library holding the same title under a different artist. The examples
show what that actually caught:

Rusko - Everyday (Netsky Remix)      filed under Def Leppard
Headhunterz - Dharma                 filed under Astrix
Delta Heavy - Kaleidoscope           filed under Chappell Roan
Beastie Boys - Fight for Your Right  filed under Mötley Crüe
Vicetone - Stars - Original Mix      filed under Steve Aoki

Different songs that happen to share a name. Across fifty thousand tracks that
is not an edge case, it is the common case. Presenting it as a matcher failure
argues for exactly the title-only matching tier that would produce this rubbish
deliberately.

Only one of the ten was real: Pendulum - Voodoo People [Pendulum Remix]
against a library that files it under The Prodigy.

The narrower signal: the library's own title credits the artist the play is
filed under. Voodoo People (Pendulum Remix) contains "Pendulum". The
normalised title has that suffix stripped -- which is what let the two meet at
all -- so the raw title is searched for the name.

Collisions are now counted and named separately, as what they are.

The same query took 47 seconds

17:31:19.128  unmatched by an artist the library holds: 1988 pairs
17:32:06.845    of those, the title exists under another artist: 700 pairs

lidarr_track was indexed on (norm_artist, norm_title). A lookup by title
alone cannot use it -- the leading column is the artist -- so every unmatched
key scanned all 84,440 tracks.

Adding an index on norm_title alone changes the plan from
AUTOMATIC PARTIAL COVERING INDEX to COVERING INDEX lidarr_track_title. The
index is created by the schema script, which only ever adds what is missing, so
an existing store picks it up on next start with no migration.

Testing

73 tests, green locally and in docker build --target test. New ones cover a
shared title not counting as a miss, a remix credited in the library title
doing so, and the query plan actually using the new index.

## Two faults, both visible in the first real run ### The split was measuring the wrong thing It reported 700 pairs / 2851 plays as attribution disagreements, on the strength of the library holding the same title under a different artist. The examples show what that actually caught: Rusko - Everyday (Netsky Remix) filed under Def Leppard Headhunterz - Dharma filed under Astrix Delta Heavy - Kaleidoscope filed under Chappell Roan Beastie Boys - Fight for Your Right filed under Mötley Crüe Vicetone - Stars - Original Mix filed under Steve Aoki Different songs that happen to share a name. Across fifty thousand tracks that is not an edge case, it is the common case. Presenting it as a matcher failure argues for exactly the title-only matching tier that would produce this rubbish deliberately. Only one of the ten was real: `Pendulum - Voodoo People [Pendulum Remix]` against a library that files it under The Prodigy. **The narrower signal:** the library's own title credits the artist the play is filed under. `Voodoo People (Pendulum Remix)` contains "Pendulum". The normalised title has that suffix stripped -- which is what let the two meet at all -- so the raw title is searched for the name. Collisions are now counted and named separately, as what they are. ### The same query took 47 seconds 17:31:19.128 unmatched by an artist the library holds: 1988 pairs 17:32:06.845 of those, the title exists under another artist: 700 pairs `lidarr_track` was indexed on `(norm_artist, norm_title)`. A lookup by title alone cannot use it -- the leading column is the artist -- so every unmatched key scanned all 84,440 tracks. Adding an index on `norm_title` alone changes the plan from `AUTOMATIC PARTIAL COVERING INDEX` to `COVERING INDEX lidarr_track_title`. The index is created by the schema script, which only ever adds what is missing, so an existing store picks it up on next start with no migration. ## Testing 73 tests, green locally and in `docker build --target test`. New ones cover a shared title *not* counting as a miss, a remix credited in the library title *doing* so, and the query plan actually using the new index.
lyrathorpe added 1 commit 2026-08-24 17:36:25 +01:00
fix: distinguish a title collision from an attribution miss, and index for it
Build and publish container / build (pull_request) Successful in 5m16s
61ce751ac5
Two faults in the split added last change, both visible in the first real run.

It reported 700 pairs as attribution disagreements on the strength of the
library holding the same title under a different artist. The examples show what
that actually caught: "Everyday" matched Def Leppard, "Kaleidoscope" matched
Chappell Roan, "Fight for Your Right" matched Motley Crue. Different songs that
happen to share a name. Across fifty thousand tracks that is not an edge case,
it is the common case, and presenting it as a matcher failure argues for exactly
the title-only matching tier that would produce this rubbish on purpose.

The signal for a real attribution miss is narrower: the library's own title
credits the artist the play is filed under, as in "Voodoo People (Pendulum
Remix)" against a scrobble credited to Pendulum. The normalised title has that
suffix stripped -- which is what let the two meet in the first place -- so the
raw title is searched for the name. Collisions are now counted and named
separately, as what they are.

The same query also took forty-seven seconds. lidarr_track was indexed on
(norm_artist, norm_title), which a lookup by title alone cannot use because its
leading column is the artist, so every unmatched key scanned all eighty-four
thousand tracks. Add the index on the title by itself; the query plan changes
from an automatic partial index to a covering one.
lyrathorpe merged commit 719a6372ad into main 2026-08-24 17:37:12 +01:00
lyrathorpe deleted branch fix/title-collisions-and-index 2026-08-24 17:37:15 +01:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lyrathorpe/music-curator#8