[PR #15803] Removing N+1 queries from the /items/Latest endpoint #14245

Open
opened 2025-12-22 10:24:09 +01:00 by backuprepo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/15803
Author: @JackDanger
Created: 12/16/2025
Status: 🔄 Open

Base: masterHead: jackdanger/optimizing-latest-endpoint


📝 Commits (3)

  • 0a2bdc0 Optimize /items/Latest: batch DTO conversion to reduce loop overhead
  • 0173e1d Add batch user data retrieval to reduce N+1 queries
  • 9a5f214 Optimize DtoService to use batch user data retrieval

📊 Changes

4 files changed (+170 additions, -13 deletions)

View changed files

📝 Emby.Server.Implementations/Dto/DtoService.cs (+58 -7)
📝 Emby.Server.Implementations/Library/UserDataManager.cs (+77 -0)
📝 Jellyfin.Api/Controllers/UserLibraryController.cs (+13 -6)
📝 MediaBrowser.Controller/Library/IUserDataManager.cs (+22 -0)

📄 Description

This PR is 3 discrete commits that address the N+1 queries on the endpoint that loads libraries into the home screen.

Prior to this change a sizable library (thousands of movies, hundreds of thousands of audio tracks) would not load faster than 30s on even very fast hardware.
After this change the endpoint returns even very large collections within 100-200ms.

This may address https://github.com/jellyfin/jellyfin/issues/15742


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/jellyfin/jellyfin/pull/15803 **Author:** [@JackDanger](https://github.com/JackDanger) **Created:** 12/16/2025 **Status:** 🔄 Open **Base:** `master` ← **Head:** `jackdanger/optimizing-latest-endpoint` --- ### 📝 Commits (3) - [`0a2bdc0`](https://github.com/jellyfin/jellyfin/commit/0a2bdc062ebd0a159b9a0bf3b62c23e35cac947f) Optimize /items/Latest: batch DTO conversion to reduce loop overhead - [`0173e1d`](https://github.com/jellyfin/jellyfin/commit/0173e1dec5c209ebc7e51dc30e3bff967a21dcfd) Add batch user data retrieval to reduce N+1 queries - [`9a5f214`](https://github.com/jellyfin/jellyfin/commit/9a5f21482e295ed23a7ad80028108a0044138fe4) Optimize DtoService to use batch user data retrieval ### 📊 Changes **4 files changed** (+170 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `Emby.Server.Implementations/Dto/DtoService.cs` (+58 -7) 📝 `Emby.Server.Implementations/Library/UserDataManager.cs` (+77 -0) 📝 `Jellyfin.Api/Controllers/UserLibraryController.cs` (+13 -6) 📝 `MediaBrowser.Controller/Library/IUserDataManager.cs` (+22 -0) </details> ### 📄 Description This PR is 3 discrete commits that address the N+1 queries on the endpoint that loads libraries into the home screen. Prior to this change a sizable library (thousands of movies, hundreds of thousands of audio tracks) would not load faster than 30s on even very fast hardware. After this change the endpoint returns even very large collections within 100-200ms. This may address https://github.com/jellyfin/jellyfin/issues/15742 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
backuprepo added the
pull-request
label 2025-12-22 10:24:09 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: starred/jellyfin#14245
No description provided.