mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-04 18:09:12 +03:00
[PR #13749] [MERGED] 2x faster library.db migration, reduced memory pressure #13691
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/jellyfin/jellyfin/pull/13749
Author: @ferferga
Created: 3/22/2025
Status: ✅ Merged
Merged: 3/23/2025
Merged by: @crobibero
Base:
master← Head:performant-librarydb-migration📝 Commits (1)
0df8492Clear dictionaries when not needed, use set for finding existing base items📊 Changes
1 file changed (+8 additions, -2 deletions)
View changed files
📝
Jellyfin.Server/Migrations/Routines/MigrateLibraryDb.cs(+8 -2)📄 Description
This PR reduces the migration from 08:57 minutes to 04:26 in my Raspberry Pi. The main performance speedup is achieved by querying all base item ids into a HashSet instead of doing queries inside the loop.
Also, clearing the collections when they're no longer needed reduced the average RAM usage while migrating (basic GC seems to trigger between steps).
I believe this could be further optimized with some parallelization, but I think this is good enough for now and I'm not sure I'm going to have time for testing before release on April.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.