mirror of
https://github.com/navidrome/navidrome.git
synced 2026-07-09 17:18:45 +00:00
|
Some checks failed
Pipeline: Test, Lint, Build / Lint i18n files (push) Has been cancelled
Pipeline: Test, Lint, Build / Check Docker configuration (push) Has been cancelled
Pipeline: Test, Lint, Build / Test JS code (push) Has been cancelled
Pipeline: Test, Lint, Build / Get version info (push) Has been cancelled
Pipeline: Test, Lint, Build / Lint Go code (push) Has been cancelled
Pipeline: Test, Lint, Build / Test Go code (push) Has been cancelled
Pipeline: Test, Lint, Build / Test Go code (Windows) (push) Has been cancelled
Pipeline: Test, Lint, Build / Package/Release (push) Has been cancelled
Pipeline: Test, Lint, Build / Upload Linux PKG (push) Has been cancelled
Pipeline: Test, Lint, Build / Build (push) Has been cancelled
Pipeline: Test, Lint, Build / Build-1 (push) Has been cancelled
Pipeline: Test, Lint, Build / Build-2 (push) Has been cancelled
Pipeline: Test, Lint, Build / Build-3 (push) Has been cancelled
Pipeline: Test, Lint, Build / Cleanup digest artifacts (push) Has been cancelled
Pipeline: Test, Lint, Build / Build-4 (push) Has been cancelled
Pipeline: Test, Lint, Build / Build-5 (push) Has been cancelled
Pipeline: Test, Lint, Build / Build-6 (push) Has been cancelled
Pipeline: Test, Lint, Build / Build-7 (push) Has been cancelled
Pipeline: Test, Lint, Build / Build Windows installers (push) Has been cancelled
Pipeline: Test, Lint, Build / Build-8 (push) Has been cancelled
Pipeline: Test, Lint, Build / Build-9 (push) Has been cancelled
Pipeline: Test, Lint, Build / Build-10 (push) Has been cancelled
Pipeline: Test, Lint, Build / Push to GHCR (push) Has been cancelled
Pipeline: Test, Lint, Build / Push to Docker Hub (push) Has been cancelled
getRandomSongs used a single ORDER BY random() over the media_file table. At large library sizes that forces SQLite to scan the wide table and sort every matching row before applying the limit — roughly 4 seconds for a 1M-track library, regardless of how many songs are requested. Add MediaFileRepository.GetRandom, which does this in two passes: first select N random rowids over a narrow index (filters + library scope only, no wide columns or joins), so the random sort runs over compact, index-friendly data; then hydrate just those rows with the full select. The wide media_file row is never part of the sort. End-to-end this drops getRandomSongs from ~4s to ~0.3s on a 1M-track library, and the cost no longer grows with the requested size. The handler now calls GetRandom directly. The filter helper that builds the genre/year filters is renamed SongsByRandom -> SongsByGenreAndYearRange to reflect what it does, since the random ordering is now owned by GetRandom rather than a Sort option. Filters (genre, year, library) compose into the first pass unchanged. The album random list path is left as-is (far fewer rows, already fast). |
||
|---|---|---|
| .. | ||
| criteria | ||
| id | ||
| metadata | ||
| request | ||
| album.go | ||
| album_test.go | ||
| annotation.go | ||
| artist.go | ||
| artist_info.go | ||
| artist_test.go | ||
| artwork_id.go | ||
| artwork_id_test.go | ||
| bookmark.go | ||
| datastore.go | ||
| errors.go | ||
| file_types.go | ||
| file_types_test.go | ||
| folder.go | ||
| folder_test.go | ||
| genre.go | ||
| get_entity.go | ||
| image.go | ||
| library.go | ||
| lyrics.go | ||
| lyrics_test.go | ||
| mediafile.go | ||
| mediafile_internal_test.go | ||
| mediafile_test.go | ||
| model_suite_test.go | ||
| participants.go | ||
| participants_test.go | ||
| player.go | ||
| playlist.go | ||
| playlist_test.go | ||
| playqueue.go | ||
| plugin.go | ||
| properties.go | ||
| radio.go | ||
| radio_test.go | ||
| scanner.go | ||
| scanner_test.go | ||
| scrobble.go | ||
| scrobble_buffer.go | ||
| searchable.go | ||
| share.go | ||
| tag.go | ||
| tag_mappings.go | ||
| tag_mappings_test.go | ||
| tag_test.go | ||
| transcoding.go | ||
| user.go | ||
| user_props.go | ||
| user_test.go | ||