From 268d88a5fb8f0f71c96ba5abcef250d1f7e049ff Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Sat, 7 Feb 2026 00:56:55 +0100 Subject: Optimize Collection Grouping, NextUp and Latest queries --- MediaBrowser.Controller/Persistence/IItemRepository.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'MediaBrowser.Controller/Persistence/IItemRepository.cs') diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs index c35e8e50a3..f1b27c52db 100644 --- a/MediaBrowser.Controller/Persistence/IItemRepository.cs +++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs @@ -188,6 +188,16 @@ public interface IItemRepository /// A tuple containing (Played count, Total count). (int Played, int Total) GetPlayedAndTotalCountFromLinkedChildren(InternalItemsQuery filter, Guid parentId); + /// + /// Batch-fetches played and total counts for multiple folder items using the AncestorIds table. + /// This avoids N+1 queries when building DTOs for lists of folder items (Series, Seasons, etc.). + /// Applies user access filtering (parental controls, tags). + /// + /// The list of folder item IDs to get counts for. + /// The user for access filtering and played status. + /// Dictionary mapping folder ID to (Played count, Total count). + Dictionary GetPlayedAndTotalCountBatch(IReadOnlyList folderIds, User user); + /// /// Gets the IDs of linked children for the specified parent. /// -- cgit v1.2.3