10.11.0 GetLatestMediaLegacy, GetItemsByUserIdLegacy 100x slower #7462

Open
opened 2025-12-22 05:49:47 +01:00 by backuprepo · 28 comments
Owner

Originally created by @monik3r on GitHub (Oct 21, 2025).

Description of the bug

I followed the steps to upgrade to 10.11.0 and everything seemed alright migration-wise, no errors. I have a large movies library of ~20k YouTube videos that I have re scanned a few times now.

When loading the main page it will take about 30-50 seconds to load recent additions, the library, etc on the page. When attempting to browse to the problem library it has not loaded after 50 minutes. Previously with 10.10.7 these would load in <500ms. It also pins a core now whenever someone attempts to load one of these pages.

To debug I have attempted to remove the problem library, upgrade from 10.10.7 to 10.11.0, then re-add a new library manually. However this doesn't help with the issue. In this library embedded image extractor, screen grabber, real time monitoring and Prefer embedded titles over filenames are enabled. 

Reproduction steps

  1. Upgrade Jellyfin 10.10.7 to 10.11.0
  2. Finish migrations
  3. Navigate to main page
  4. Try to view library

What is the current bug behavior?

Recent videos and other elements for the problem library are 100x slower to load, the library page never finishes loading to display the library,

What is the expected correct behavior?

Main page and library load as approximately fast as previous versions.

Jellyfin Server version

10.10.0+

Specify commit id

No response

Specify unstable release number

No response

Specify version number

No response

Specify the build version

10.11.0

Environment

- OS: Ubuntu 24
- Linux Kernel: 6.8.0-63-generic
- Virtualization: n/a, docker
- Clients: Firefox, Android
- Browser: Firefox
- FFmpeg Version: Whatever is in docker
- Playback Method: 
- Hardware Acceleration: n/a
- GPU Model: n/a
- Plugins: default (none added)
- Reverse Proxy: n/a
- Base URL: jellyfin.local
- Networking: Docker
- Jellyfin Data Storage: ZFS array, local hard drives, recent successful scrub
- Media Storage: ZFS array, local hard drives, recent successful scrub
- External Integrations: None

Jellyfin logs

GetLatestMediaLegacy Log for 10.10:

[01:26:23] [DBG] [23] Emby.Server.Implementations.Data.SqliteItemRepository: GetItemList query time (slow): 250.3336ms. Query: select type,data,StartDate,EndDate,ChannelId,IsMovie,IsSeries,EpisodeTitle,IsRepeat,CommunityRating,IndexNumber,Width,Height,Name,Path,PremiereDate,ParentIndexNumber,ProductionYear,OfficialRating,RunTimeTicks,Size,DateModified,guid,ParentId,Audio,ExternalServiceId,IsInMixedFolder,Tags,TrailerTypes,PrimaryVersionId,Album,LUFS,NormalizationGain,CriticRating,IsVirtualItem,SeriesName,SeasonName,SeasonId,SeriesId,ProviderIds,Images,TotalBitrate,ExtraType,Artists,AlbumArtists,ExternalId,ShowId,OwnerId,UserDatas.UserId,UserDatas.lastPlayedDate,UserDatas.playbackPositionTicks,UserDatas.playcount,UserDatas.isFavorite,UserDatas.played,UserDatas.rating from TypedBaseItems A left join UserDatas on UserDataKey=UserDatas.Key And (UserId=@UserId) where IsFolder=@IsFolder AND (played is null or played=@IsPlayed) AND IsVirtualItem=@IsVirtualItem AND MediaType=@MediaTypes AND (TopParentId=@TopParentId) Group by PresentationUniqueKey ORDER BY DateCreated DESC,SortName DESC,ProductionYear DESC LIMIT 80


GetLatestMediaLegacy Log for 10.11:

[02:52:40] [INF] [24] Microsoft.EntityFrameworkCore.Database.Command: Executed DbCommand (25,385ms) [Parameters=[@__filter_IsFolder_0='?' (DbType = Boolean), @__filter_User_Id_1='?' (DbType = Guid), @__filter_IsPlayed_2='?' (DbType = Boolean), @__isVirtualItem_Value_3='?' (DbType = Boolean), @__p_4='?' (DbType = Int32)], CommandType='Text', CommandTimeout='30']
SELECT "b6"."Id", "b6"."Album", "b6"."AlbumArtists", "b6"."Artists", "b6"."Audio", "b6"."ChannelId", "b6"."CleanName", "b6"."CommunityRating", "b6"."CriticRating", "b6"."CustomRating", "b6"."Data", "b6"."DateCreated", "b6"."DateLastMediaAdded", "b6"."DateLastRefreshed", "b6"."DateLastSaved", "b6"."DateModified", "b6"."EndDate", "b6"."EpisodeTitle", "b6"."ExternalId", "b6"."ExternalSeriesId", "b6"."ExternalServiceId", "b6"."ExtraIds", "b6"."ExtraType", "b6"."ForcedSortName", "b6"."Genres", "b6"."Height", "b6"."IndexNumber", "b6"."InheritedParentalRatingSubValue", "b6"."InheritedParentalRatingValue", "b6"."IsFolder", "b6"."IsInMixedFolder", "b6"."IsLocked", "b6"."IsMovie", "b6"."IsRepeat", "b6"."IsSeries", "b6"."IsVirtualItem", "b6"."LUFS", "b6"."MediaType", "b6"."Name", "b6"."NormalizationGain", "b6"."OfficialRating", "b6"."OriginalTitle", "b6"."Overview", "b6"."OwnerId", "b6"."ParentId", "b6"."ParentIndexNumber", "b6"."Path", "b6"."PreferredMetadataCountryCode", "b6"."PreferredMetadataLanguage", "b6"."PremiereDate", "b6"."PresentationUniqueKey", "b6"."PrimaryVersionId", "b6"."ProductionLocations", "b6"."ProductionYear", "b6"."RunTimeTicks", "b6"."SeasonId", "b6"."SeasonName", "b6"."SeriesId", "b6"."SeriesName", "b6"."SeriesPresentationUniqueKey", "b6"."ShowId", "b6"."Size", "b6"."SortName", "b6"."StartDate", "b6"."Studios", "b6"."Tagline", "b6"."Tags", "b6"."TopParentId", "b6"."TotalBitrate", "b6"."Type", "b6"."UnratedType", "b6"."Width", "b2"."Id", "b2"."ItemId", "b3"."ItemId", "b3"."ProviderId", "b3"."ProviderValue", "b4"."Id", "b4"."ItemId", "u1"."ItemId", "u1"."UserId", "u1"."CustomDataKey", "u1"."AudioStreamIndex", "u1"."IsFavorite", "u1"."LastPlayedDate", "u1"."Likes", "u1"."PlayCount", "u1"."PlaybackPositionTicks", "u1"."Played", "u1"."Rating", "u1"."RetentionDate", "u1"."SubtitleStreamIndex", "b5"."Id", "b5"."Blurhash", "b5"."DateModified", "b5"."Height", "b5"."ImageType", "b5"."ItemId", "b5"."Path", "b5"."Width"
FROM (
    SELECT "b"."Id", "b"."Album", "b"."AlbumArtists", "b"."Artists", "b"."Audio", "b"."ChannelId", "b"."CleanName", "b"."CommunityRating", "b"."CriticRating", "b"."CustomRating", "b"."Data", "b"."DateCreated", "b"."DateLastMediaAdded", "b"."DateLastRefreshed", "b"."DateLastSaved", "b"."DateModified", "b"."EndDate", "b"."EpisodeTitle", "b"."ExternalId", "b"."ExternalSeriesId", "b"."ExternalServiceId", "b"."ExtraIds", "b"."ExtraType", "b"."ForcedSortName", "b"."Genres", "b"."Height", "b"."IndexNumber", "b"."InheritedParentalRatingSubValue", "b"."InheritedParentalRatingValue", "b"."IsFolder", "b"."IsInMixedFolder", "b"."IsLocked", "b"."IsMovie", "b"."IsRepeat", "b"."IsSeries", "b"."IsVirtualItem", "b"."LUFS", "b"."MediaType", "b"."Name", "b"."NormalizationGain", "b"."OfficialRating", "b"."OriginalTitle", "b"."Overview", "b"."OwnerId", "b"."ParentId", "b"."ParentIndexNumber", "b"."Path", "b"."PreferredMetadataCountryCode", "b"."PreferredMetadataLanguage", "b"."PremiereDate", "b"."PresentationUniqueKey", "b"."PrimaryVersionId", "b"."ProductionLocations", "b"."ProductionYear", "b"."RunTimeTicks", "b"."SeasonId", "b"."SeasonName", "b"."SeriesId", "b"."SeriesName", "b"."SeriesPresentationUniqueKey", "b"."ShowId", "b"."Size", "b"."SortName", "b"."StartDate", "b"."Studios", "b"."Tagline", "b"."Tags", "b"."TopParentId", "b"."TotalBitrate", "b"."Type", "b"."UnratedType", "b"."Width"
    FROM "BaseItems" AS "b"
    WHERE "b"."Id" IN (
        SELECT (
            SELECT "b1"."Id"
            FROM "BaseItems" AS "b1"
            WHERE "b1"."IsFolder" = @__filter_IsFolder_0 AND COALESCE((
                SELECT "u0"."Played"
                FROM "UserData" AS "u0"
                WHERE "b1"."Id" = "u0"."ItemId" AND "u0"."UserId" = @__filter_User_Id_1
                LIMIT 1), 0) = @__filter_IsPlayed_2 AND "b1"."IsVirtualItem" = @__isVirtualItem_Value_3 AND "b1"."MediaType" = 'Video' AND "b1"."TopParentId" = '65E0C354-8C9D-74AC-4214-5F90423A863A' AND ("b0"."PresentationUniqueKey" = "b1"."PresentationUniqueKey" OR ("b0"."PresentationUniqueKey" IS NULL AND "b1"."PresentationUniqueKey" IS NULL))
            LIMIT 1)
        FROM "BaseItems" AS "b0"
        WHERE "b0"."IsFolder" = @__filter_IsFolder_0 AND COALESCE((
            SELECT "u"."Played"
            FROM "UserData" AS "u"
            WHERE "b0"."Id" = "u"."ItemId" AND "u"."UserId" = @__filter_User_Id_1
            LIMIT 1), 0) = @__filter_IsPlayed_2 AND "b0"."IsVirtualItem" = @__isVirtualItem_Value_3 AND "b0"."MediaType" = 'Video' AND "b0"."TopParentId" = '65E0C354-8C9D-74AC-4214-5F90423A863A'
        GROUP BY "b0"."PresentationUniqueKey"
    )
    ORDER BY "b"."DateCreated" DESC, "b"."SortName" DESC, "b"."ProductionYear" DESC
    LIMIT @__p_4
) AS "b6"
LEFT JOIN "BaseItemTrailerTypes" AS "b2" ON "b6"."Id" = "b2"."ItemId"
LEFT JOIN "BaseItemProviders" AS "b3" ON "b6"."Id" = "b3"."ItemId"
LEFT JOIN "BaseItemMetadataFields" AS "b4" ON "b6"."Id" = "b4"."ItemId"
LEFT JOIN "UserData" AS "u1" ON "b6"."Id" = "u1"."ItemId"
LEFT JOIN "BaseItemImageInfos" AS "b5" ON "b6"."Id" = "b5"."ItemId"
ORDER BY "b6"."DateCreated" DESC, "b6"."SortName" DESC, "b6"."ProductionYear" DESC, "b6"."Id", "b2"."Id", "b2"."ItemId", "b3"."ItemId", "b3"."ProviderId", "b4"."Id", "b4"."ItemId", "u1"."ItemId", "u1"."UserId", "u1"."CustomDataKey"
[02:52:40] [INF] [24] Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor: Executing OkResult`1, writing value of type 'System.Linq.Enumerable+ListSelectIterator`2[[System.Tuple`2[[MediaBrowser.Controller.Entities.BaseItem, MediaBrowser.Controller, Version=10.11.0.0, Culture=neutral, PublicKeyToken=null],[System.Collections.Generic.List`1[[MediaBrowser.Controller.Entities.BaseItem, MediaBrowser.Controller, Version=10.11.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[MediaBrowser.Model.Dto.BaseItemDto, MediaBrowser.Model, Version=10.11.0.0, Culture=neutral, PublicKeyToken=null]]'.
[02:52:40] [INF] [24] Microsoft.EntityFrameworkCore.Database.Command: Executed DbCommand (1ms) [Parameters=[@__id_0='?' (DbType = Guid)], CommandType='Text', CommandTimeout='30']
SELECT "b4"."Id", "b4"."Album", "b4"."AlbumArtists", "b4"."Artists", "b4"."Audio", "b4"."ChannelId", "b4"."CleanName", "b4"."CommunityRating", "b4"."CriticRating", "b4"."CustomRating", "b4"."Data", "b4"."DateCreated", "b4"."DateLastMediaAdded", "b4"."DateLastRefreshed", "b4"."DateLastSaved", "b4"."DateModified", "b4"."EndDate", "b4"."EpisodeTitle", "b4"."ExternalId", "b4"."ExternalSeriesId", "b4"."ExternalServiceId", "b4"."ExtraIds", "b4"."ExtraType", "b4"."ForcedSortName", "b4"."Genres", "b4"."Height", "b4"."IndexNumber", "b4"."InheritedParentalRatingSubValue", "b4"."InheritedParentalRatingValue", "b4"."IsFolder", "b4"."IsInMixedFolder", "b4"."IsLocked", "b4"."IsMovie", "b4"."IsRepeat", "b4"."IsSeries", "b4"."IsVirtualItem", "b4"."LUFS", "b4"."MediaType", "b4"."Name", "b4"."NormalizationGain", "b4"."OfficialRating", "b4"."OriginalTitle", "b4"."Overview", "b4"."OwnerId", "b4"."ParentId", "b4"."ParentIndexNumber", "b4"."Path", "b4"."PreferredMetadataCountryCode", "b4"."PreferredMetadataLanguage", "b4"."PremiereDate", "b4"."PresentationUniqueKey", "b4"."PrimaryVersionId", "b4"."ProductionLocations", "b4"."ProductionYear", "b4"."RunTimeTicks", "b4"."SeasonId", "b4"."SeasonName", "b4"."SeriesId", "b4"."SeriesName", "b4"."SeriesPresentationUniqueKey", "b4"."ShowId", "b4"."Size", "b4"."SortName", "b4"."StartDate", "b4"."Studios", "b4"."Tagline", "b4"."Tags", "b4"."TopParentId", "b4"."TotalBitrate", "b4"."Type", "b4"."UnratedType", "b4"."Width", "b0"."Id", "b0"."ItemId", "b1"."ItemId", "b1"."ProviderId", "b1"."ProviderValue", "b2"."Id", "b2"."ItemId", "u"."ItemId", "u"."UserId", "u"."CustomDataKey", "u"."AudioStreamIndex", "u"."IsFavorite", "u"."LastPlayedDate", "u"."Likes", "u"."PlayCount", "u"."PlaybackPositionTicks", "u"."Played", "u"."Rating", "u"."RetentionDate", "u"."SubtitleStreamIndex", "b3"."Id", "b3"."Blurhash", "b3"."DateModified", "b3"."Height", "b3"."ImageType", "b3"."ItemId", "b3"."Path", "b3"."Width"
FROM (
    SELECT "b"."Id", "b"."Album", "b"."AlbumArtists", "b"."Artists", "b"."Audio", "b"."ChannelId", "b"."CleanName", "b"."CommunityRating", "b"."CriticRating", "b"."CustomRating", "b"."Data", "b"."DateCreated", "b"."DateLastMediaAdded", "b"."DateLastRefreshed", "b"."DateLastSaved", "b"."DateModified", "b"."EndDate", "b"."EpisodeTitle", "b"."ExternalId", "b"."ExternalSeriesId", "b"."ExternalServiceId", "b"."ExtraIds", "b"."ExtraType", "b"."ForcedSortName", "b"."Genres", "b"."Height", "b"."IndexNumber", "b"."InheritedParentalRatingSubValue", "b"."InheritedParentalRatingValue", "b"."IsFolder", "b"."IsInMixedFolder", "b"."IsLocked", "b"."IsMovie", "b"."IsRepeat", "b"."IsSeries", "b"."IsVirtualItem", "b"."LUFS", "b"."MediaType", "b"."Name", "b"."NormalizationGain", "b"."OfficialRating", "b"."OriginalTitle", "b"."Overview", "b"."OwnerId", "b"."ParentId", "b"."ParentIndexNumber", "b"."Path", "b"."PreferredMetadataCountryCode", "b"."PreferredMetadataLanguage", "b"."PremiereDate", "b"."PresentationUniqueKey", "b"."PrimaryVersionId", "b"."ProductionLocations", "b"."ProductionYear", "b"."RunTimeTicks", "b"."SeasonId", "b"."SeasonName", "b"."SeriesId", "b"."SeriesName", "b"."SeriesPresentationUniqueKey", "b"."ShowId", "b"."Size", "b"."SortName", "b"."StartDate", "b"."Studios", "b"."Tagline", "b"."Tags", "b"."TopParentId", "b"."TotalBitrate", "b"."Type", "b"."UnratedType", "b"."Width"
    FROM "BaseItems" AS "b"
    WHERE "b"."Id" = @__id_0
    LIMIT 1
) AS "b4"
LEFT JOIN "BaseItemTrailerTypes" AS "b0" ON "b4"."Id" = "b0"."ItemId"
LEFT JOIN "BaseItemProviders" AS "b1" ON "b4"."Id" = "b1"."ItemId"
LEFT JOIN "BaseItemMetadataFields" AS "b2" ON "b4"."Id" = "b2"."ItemId"
LEFT JOIN "UserData" AS "u" ON "b4"."Id" = "u"."ItemId"
LEFT JOIN "BaseItemImageInfos" AS "b3" ON "b4"."Id" = "b3"."ItemId"
ORDER BY "b4"."Id", "b0"."Id", "b0"."ItemId", "b1"."ItemId", "b1"."ProviderId", "b2"."Id", "b2"."ItemId", "u"."ItemId", "u"."UserId", "u"."CustomDataKey"


For loading the library itself in 10.11 here is (logs of the thread? that handles) the request that never returns/finishes after 50 minutes:

[02:24:30] [INF] [19] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory /media/tube
[02:53:21] [INF] [19] Microsoft.AspNetCore.Hosting.Diagnostics: Request starting HTTP/1.0 GET http://jellyfin.local/Users/3746f94ab2094ee1b7d45300775081d1/Items?SortBy=DateCreated%2CSortName%2CProductionYear&SortOrder=Descending&IncludeItemTypes=Movie&Recursive=true&Fields=PrimaryImageAspectRatio%2CMediaSourceCount&ImageTypeLimit=1&EnableImageTypes=Primary%2CBackdrop%2CBanner%2CThumb&StartIndex=0&ParentId=34f331a89ce405e2b877d68d5ee4d4a2&Limit=100 - null null
[02:53:21] [INF] [19] Microsoft.AspNetCore.Routing.EndpointMiddleware: Executing endpoint 'Jellyfin.Api.Controllers.ItemsController.GetItemsByUserIdLegacy (Jellyfin.Api)'
[02:53:21] [INF] [19] Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Route matched with {action = "GetItemsByUserIdLegacy", controller = "Items"}. Executing controller action with signature Microsoft.AspNetCore.Mvc.ActionResult`1[MediaBrowser.Model.Querying.QueryResult`1[MediaBrowser.Model.Dto.BaseItemDto]] GetItemsByUserIdLegacy(System.Guid, System.String, System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Guid], System.Nullable`1[System.Int32], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], MediaBrowser.Model.Entities.LocationType[], MediaBrowser.Model.Entities.LocationType[], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Double], System.Nullable`1[System.Double], System.Nullable`1[System.DateTime], System.Nullable`1[System.DateTime], System.Nullable`1[System.DateTime], System.Nullable`1[System.DateTime], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Guid[], System.Nullable`1[System.Int32], System.Nullable`1[System.Int32], System.Nullable`1[System.Boolean], System.String, Jellyfin.Database.Implementations.Enums.SortOrder[], System.Nullable`1[System.Guid], MediaBrowser.Model.Querying.ItemFields[], Jellyfin.Data.Enums.BaseItemKind[], Jellyfin.Data.Enums.BaseItemKind[], MediaBrowser.Model.Querying.ItemFilter[], System.Nullable`1[System.Boolean], Jellyfin.Data.Enums.MediaType[], MediaBrowser.Model.Entities.ImageType[], Jellyfin.Data.Enums.ItemSortBy[], System.Nullable`1[System.Boolean], System.String[], System.String[], System.String[], Int32[], System.Nullable`1[System.Boolean], System.Nullable`1[System.Int32], MediaBrowser.Model.Entities.ImageType[], System.String, System.Guid[], System.String[], System.String[], System.String[], System.Guid[], System.Guid[], System.Guid[], System.Guid[], System.String[], System.Guid[], System.Guid[], MediaBrowser.Model.Entities.VideoType[], System.String, System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Int32], System.Nullable`1[System.Int32], System.Nullable`1[System.Int32], System.Nullable`1[System.Int32], System.Nullable`1[System.Boolean], MediaBrowser.Model.Entities.SeriesStatus[], System.String, System.String, System.String, System.Guid[], System.Guid[], Boolean, System.Nullable`1[System.Boolean]) on controller Jellyfin.Api.Controllers.ItemsController (Jellyfin.Api).

FFmpeg logs


Client / Browser logs

No response

Relevant screenshots or videos

No response

Additional information

No response

Originally created by @monik3r on GitHub (Oct 21, 2025). ### Description of the bug I followed the steps to upgrade to 10.11.0 and everything seemed alright migration-wise, no errors. I have a large movies library of ~20k YouTube videos that I have re scanned a few times now. When loading the main page it will take about 30-50 seconds to load recent additions, the library, etc on the page. When attempting to browse to the problem library it has not loaded after 50 minutes. Previously with 10.10.7 these would load in <500ms. It also pins a core now whenever someone attempts to load one of these pages. To debug I have attempted to remove the problem library, upgrade from 10.10.7 to 10.11.0, then re-add a new library manually. However this doesn't help with the issue. In this library embedded image extractor, screen grabber, real time monitoring and Prefer embedded titles over filenames are enabled.  ### Reproduction steps 1. Upgrade Jellyfin 10.10.7 to 10.11.0 2. Finish migrations 3. Navigate to main page 4. Try to view library ### What is the current _bug_ behavior? Recent videos and other elements for the problem library are 100x slower to load, the library page never finishes loading to display the library, ### What is the expected _correct_ behavior? Main page and library load as approximately fast as previous versions. ### Jellyfin Server version 10.10.0+ ### Specify commit id _No response_ ### Specify unstable release number _No response_ ### Specify version number _No response_ ### Specify the build version 10.11.0 ### Environment ```markdown - OS: Ubuntu 24 - Linux Kernel: 6.8.0-63-generic - Virtualization: n/a, docker - Clients: Firefox, Android - Browser: Firefox - FFmpeg Version: Whatever is in docker - Playback Method: - Hardware Acceleration: n/a - GPU Model: n/a - Plugins: default (none added) - Reverse Proxy: n/a - Base URL: jellyfin.local - Networking: Docker - Jellyfin Data Storage: ZFS array, local hard drives, recent successful scrub - Media Storage: ZFS array, local hard drives, recent successful scrub - External Integrations: None ``` ### Jellyfin logs ```shell GetLatestMediaLegacy Log for 10.10: [01:26:23] [DBG] [23] Emby.Server.Implementations.Data.SqliteItemRepository: GetItemList query time (slow): 250.3336ms. Query: select type,data,StartDate,EndDate,ChannelId,IsMovie,IsSeries,EpisodeTitle,IsRepeat,CommunityRating,IndexNumber,Width,Height,Name,Path,PremiereDate,ParentIndexNumber,ProductionYear,OfficialRating,RunTimeTicks,Size,DateModified,guid,ParentId,Audio,ExternalServiceId,IsInMixedFolder,Tags,TrailerTypes,PrimaryVersionId,Album,LUFS,NormalizationGain,CriticRating,IsVirtualItem,SeriesName,SeasonName,SeasonId,SeriesId,ProviderIds,Images,TotalBitrate,ExtraType,Artists,AlbumArtists,ExternalId,ShowId,OwnerId,UserDatas.UserId,UserDatas.lastPlayedDate,UserDatas.playbackPositionTicks,UserDatas.playcount,UserDatas.isFavorite,UserDatas.played,UserDatas.rating from TypedBaseItems A left join UserDatas on UserDataKey=UserDatas.Key And (UserId=@UserId) where IsFolder=@IsFolder AND (played is null or played=@IsPlayed) AND IsVirtualItem=@IsVirtualItem AND MediaType=@MediaTypes AND (TopParentId=@TopParentId) Group by PresentationUniqueKey ORDER BY DateCreated DESC,SortName DESC,ProductionYear DESC LIMIT 80 GetLatestMediaLegacy Log for 10.11: [02:52:40] [INF] [24] Microsoft.EntityFrameworkCore.Database.Command: Executed DbCommand (25,385ms) [Parameters=[@__filter_IsFolder_0='?' (DbType = Boolean), @__filter_User_Id_1='?' (DbType = Guid), @__filter_IsPlayed_2='?' (DbType = Boolean), @__isVirtualItem_Value_3='?' (DbType = Boolean), @__p_4='?' (DbType = Int32)], CommandType='Text', CommandTimeout='30'] SELECT "b6"."Id", "b6"."Album", "b6"."AlbumArtists", "b6"."Artists", "b6"."Audio", "b6"."ChannelId", "b6"."CleanName", "b6"."CommunityRating", "b6"."CriticRating", "b6"."CustomRating", "b6"."Data", "b6"."DateCreated", "b6"."DateLastMediaAdded", "b6"."DateLastRefreshed", "b6"."DateLastSaved", "b6"."DateModified", "b6"."EndDate", "b6"."EpisodeTitle", "b6"."ExternalId", "b6"."ExternalSeriesId", "b6"."ExternalServiceId", "b6"."ExtraIds", "b6"."ExtraType", "b6"."ForcedSortName", "b6"."Genres", "b6"."Height", "b6"."IndexNumber", "b6"."InheritedParentalRatingSubValue", "b6"."InheritedParentalRatingValue", "b6"."IsFolder", "b6"."IsInMixedFolder", "b6"."IsLocked", "b6"."IsMovie", "b6"."IsRepeat", "b6"."IsSeries", "b6"."IsVirtualItem", "b6"."LUFS", "b6"."MediaType", "b6"."Name", "b6"."NormalizationGain", "b6"."OfficialRating", "b6"."OriginalTitle", "b6"."Overview", "b6"."OwnerId", "b6"."ParentId", "b6"."ParentIndexNumber", "b6"."Path", "b6"."PreferredMetadataCountryCode", "b6"."PreferredMetadataLanguage", "b6"."PremiereDate", "b6"."PresentationUniqueKey", "b6"."PrimaryVersionId", "b6"."ProductionLocations", "b6"."ProductionYear", "b6"."RunTimeTicks", "b6"."SeasonId", "b6"."SeasonName", "b6"."SeriesId", "b6"."SeriesName", "b6"."SeriesPresentationUniqueKey", "b6"."ShowId", "b6"."Size", "b6"."SortName", "b6"."StartDate", "b6"."Studios", "b6"."Tagline", "b6"."Tags", "b6"."TopParentId", "b6"."TotalBitrate", "b6"."Type", "b6"."UnratedType", "b6"."Width", "b2"."Id", "b2"."ItemId", "b3"."ItemId", "b3"."ProviderId", "b3"."ProviderValue", "b4"."Id", "b4"."ItemId", "u1"."ItemId", "u1"."UserId", "u1"."CustomDataKey", "u1"."AudioStreamIndex", "u1"."IsFavorite", "u1"."LastPlayedDate", "u1"."Likes", "u1"."PlayCount", "u1"."PlaybackPositionTicks", "u1"."Played", "u1"."Rating", "u1"."RetentionDate", "u1"."SubtitleStreamIndex", "b5"."Id", "b5"."Blurhash", "b5"."DateModified", "b5"."Height", "b5"."ImageType", "b5"."ItemId", "b5"."Path", "b5"."Width" FROM (     SELECT "b"."Id", "b"."Album", "b"."AlbumArtists", "b"."Artists", "b"."Audio", "b"."ChannelId", "b"."CleanName", "b"."CommunityRating", "b"."CriticRating", "b"."CustomRating", "b"."Data", "b"."DateCreated", "b"."DateLastMediaAdded", "b"."DateLastRefreshed", "b"."DateLastSaved", "b"."DateModified", "b"."EndDate", "b"."EpisodeTitle", "b"."ExternalId", "b"."ExternalSeriesId", "b"."ExternalServiceId", "b"."ExtraIds", "b"."ExtraType", "b"."ForcedSortName", "b"."Genres", "b"."Height", "b"."IndexNumber", "b"."InheritedParentalRatingSubValue", "b"."InheritedParentalRatingValue", "b"."IsFolder", "b"."IsInMixedFolder", "b"."IsLocked", "b"."IsMovie", "b"."IsRepeat", "b"."IsSeries", "b"."IsVirtualItem", "b"."LUFS", "b"."MediaType", "b"."Name", "b"."NormalizationGain", "b"."OfficialRating", "b"."OriginalTitle", "b"."Overview", "b"."OwnerId", "b"."ParentId", "b"."ParentIndexNumber", "b"."Path", "b"."PreferredMetadataCountryCode", "b"."PreferredMetadataLanguage", "b"."PremiereDate", "b"."PresentationUniqueKey", "b"."PrimaryVersionId", "b"."ProductionLocations", "b"."ProductionYear", "b"."RunTimeTicks", "b"."SeasonId", "b"."SeasonName", "b"."SeriesId", "b"."SeriesName", "b"."SeriesPresentationUniqueKey", "b"."ShowId", "b"."Size", "b"."SortName", "b"."StartDate", "b"."Studios", "b"."Tagline", "b"."Tags", "b"."TopParentId", "b"."TotalBitrate", "b"."Type", "b"."UnratedType", "b"."Width"     FROM "BaseItems" AS "b"     WHERE "b"."Id" IN (         SELECT (             SELECT "b1"."Id"             FROM "BaseItems" AS "b1"             WHERE "b1"."IsFolder" = @__filter_IsFolder_0 AND COALESCE((                 SELECT "u0"."Played"                 FROM "UserData" AS "u0"                 WHERE "b1"."Id" = "u0"."ItemId" AND "u0"."UserId" = @__filter_User_Id_1                 LIMIT 1), 0) = @__filter_IsPlayed_2 AND "b1"."IsVirtualItem" = @__isVirtualItem_Value_3 AND "b1"."MediaType" = 'Video' AND "b1"."TopParentId" = '65E0C354-8C9D-74AC-4214-5F90423A863A' AND ("b0"."PresentationUniqueKey" = "b1"."PresentationUniqueKey" OR ("b0"."PresentationUniqueKey" IS NULL AND "b1"."PresentationUniqueKey" IS NULL))             LIMIT 1)         FROM "BaseItems" AS "b0"         WHERE "b0"."IsFolder" = @__filter_IsFolder_0 AND COALESCE((             SELECT "u"."Played"             FROM "UserData" AS "u"             WHERE "b0"."Id" = "u"."ItemId" AND "u"."UserId" = @__filter_User_Id_1             LIMIT 1), 0) = @__filter_IsPlayed_2 AND "b0"."IsVirtualItem" = @__isVirtualItem_Value_3 AND "b0"."MediaType" = 'Video' AND "b0"."TopParentId" = '65E0C354-8C9D-74AC-4214-5F90423A863A'         GROUP BY "b0"."PresentationUniqueKey"     )     ORDER BY "b"."DateCreated" DESC, "b"."SortName" DESC, "b"."ProductionYear" DESC     LIMIT @__p_4 ) AS "b6" LEFT JOIN "BaseItemTrailerTypes" AS "b2" ON "b6"."Id" = "b2"."ItemId" LEFT JOIN "BaseItemProviders" AS "b3" ON "b6"."Id" = "b3"."ItemId" LEFT JOIN "BaseItemMetadataFields" AS "b4" ON "b6"."Id" = "b4"."ItemId" LEFT JOIN "UserData" AS "u1" ON "b6"."Id" = "u1"."ItemId" LEFT JOIN "BaseItemImageInfos" AS "b5" ON "b6"."Id" = "b5"."ItemId" ORDER BY "b6"."DateCreated" DESC, "b6"."SortName" DESC, "b6"."ProductionYear" DESC, "b6"."Id", "b2"."Id", "b2"."ItemId", "b3"."ItemId", "b3"."ProviderId", "b4"."Id", "b4"."ItemId", "u1"."ItemId", "u1"."UserId", "u1"."CustomDataKey" [02:52:40] [INF] [24] Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor: Executing OkResult`1, writing value of type 'System.Linq.Enumerable+ListSelectIterator`2[[System.Tuple`2[[MediaBrowser.Controller.Entities.BaseItem, MediaBrowser.Controller, Version=10.11.0.0, Culture=neutral, PublicKeyToken=null],[System.Collections.Generic.List`1[[MediaBrowser.Controller.Entities.BaseItem, MediaBrowser.Controller, Version=10.11.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[MediaBrowser.Model.Dto.BaseItemDto, MediaBrowser.Model, Version=10.11.0.0, Culture=neutral, PublicKeyToken=null]]'. [02:52:40] [INF] [24] Microsoft.EntityFrameworkCore.Database.Command: Executed DbCommand (1ms) [Parameters=[@__id_0='?' (DbType = Guid)], CommandType='Text', CommandTimeout='30'] SELECT "b4"."Id", "b4"."Album", "b4"."AlbumArtists", "b4"."Artists", "b4"."Audio", "b4"."ChannelId", "b4"."CleanName", "b4"."CommunityRating", "b4"."CriticRating", "b4"."CustomRating", "b4"."Data", "b4"."DateCreated", "b4"."DateLastMediaAdded", "b4"."DateLastRefreshed", "b4"."DateLastSaved", "b4"."DateModified", "b4"."EndDate", "b4"."EpisodeTitle", "b4"."ExternalId", "b4"."ExternalSeriesId", "b4"."ExternalServiceId", "b4"."ExtraIds", "b4"."ExtraType", "b4"."ForcedSortName", "b4"."Genres", "b4"."Height", "b4"."IndexNumber", "b4"."InheritedParentalRatingSubValue", "b4"."InheritedParentalRatingValue", "b4"."IsFolder", "b4"."IsInMixedFolder", "b4"."IsLocked", "b4"."IsMovie", "b4"."IsRepeat", "b4"."IsSeries", "b4"."IsVirtualItem", "b4"."LUFS", "b4"."MediaType", "b4"."Name", "b4"."NormalizationGain", "b4"."OfficialRating", "b4"."OriginalTitle", "b4"."Overview", "b4"."OwnerId", "b4"."ParentId", "b4"."ParentIndexNumber", "b4"."Path", "b4"."PreferredMetadataCountryCode", "b4"."PreferredMetadataLanguage", "b4"."PremiereDate", "b4"."PresentationUniqueKey", "b4"."PrimaryVersionId", "b4"."ProductionLocations", "b4"."ProductionYear", "b4"."RunTimeTicks", "b4"."SeasonId", "b4"."SeasonName", "b4"."SeriesId", "b4"."SeriesName", "b4"."SeriesPresentationUniqueKey", "b4"."ShowId", "b4"."Size", "b4"."SortName", "b4"."StartDate", "b4"."Studios", "b4"."Tagline", "b4"."Tags", "b4"."TopParentId", "b4"."TotalBitrate", "b4"."Type", "b4"."UnratedType", "b4"."Width", "b0"."Id", "b0"."ItemId", "b1"."ItemId", "b1"."ProviderId", "b1"."ProviderValue", "b2"."Id", "b2"."ItemId", "u"."ItemId", "u"."UserId", "u"."CustomDataKey", "u"."AudioStreamIndex", "u"."IsFavorite", "u"."LastPlayedDate", "u"."Likes", "u"."PlayCount", "u"."PlaybackPositionTicks", "u"."Played", "u"."Rating", "u"."RetentionDate", "u"."SubtitleStreamIndex", "b3"."Id", "b3"."Blurhash", "b3"."DateModified", "b3"."Height", "b3"."ImageType", "b3"."ItemId", "b3"."Path", "b3"."Width" FROM (     SELECT "b"."Id", "b"."Album", "b"."AlbumArtists", "b"."Artists", "b"."Audio", "b"."ChannelId", "b"."CleanName", "b"."CommunityRating", "b"."CriticRating", "b"."CustomRating", "b"."Data", "b"."DateCreated", "b"."DateLastMediaAdded", "b"."DateLastRefreshed", "b"."DateLastSaved", "b"."DateModified", "b"."EndDate", "b"."EpisodeTitle", "b"."ExternalId", "b"."ExternalSeriesId", "b"."ExternalServiceId", "b"."ExtraIds", "b"."ExtraType", "b"."ForcedSortName", "b"."Genres", "b"."Height", "b"."IndexNumber", "b"."InheritedParentalRatingSubValue", "b"."InheritedParentalRatingValue", "b"."IsFolder", "b"."IsInMixedFolder", "b"."IsLocked", "b"."IsMovie", "b"."IsRepeat", "b"."IsSeries", "b"."IsVirtualItem", "b"."LUFS", "b"."MediaType", "b"."Name", "b"."NormalizationGain", "b"."OfficialRating", "b"."OriginalTitle", "b"."Overview", "b"."OwnerId", "b"."ParentId", "b"."ParentIndexNumber", "b"."Path", "b"."PreferredMetadataCountryCode", "b"."PreferredMetadataLanguage", "b"."PremiereDate", "b"."PresentationUniqueKey", "b"."PrimaryVersionId", "b"."ProductionLocations", "b"."ProductionYear", "b"."RunTimeTicks", "b"."SeasonId", "b"."SeasonName", "b"."SeriesId", "b"."SeriesName", "b"."SeriesPresentationUniqueKey", "b"."ShowId", "b"."Size", "b"."SortName", "b"."StartDate", "b"."Studios", "b"."Tagline", "b"."Tags", "b"."TopParentId", "b"."TotalBitrate", "b"."Type", "b"."UnratedType", "b"."Width"     FROM "BaseItems" AS "b"     WHERE "b"."Id" = @__id_0     LIMIT 1 ) AS "b4" LEFT JOIN "BaseItemTrailerTypes" AS "b0" ON "b4"."Id" = "b0"."ItemId" LEFT JOIN "BaseItemProviders" AS "b1" ON "b4"."Id" = "b1"."ItemId" LEFT JOIN "BaseItemMetadataFields" AS "b2" ON "b4"."Id" = "b2"."ItemId" LEFT JOIN "UserData" AS "u" ON "b4"."Id" = "u"."ItemId" LEFT JOIN "BaseItemImageInfos" AS "b3" ON "b4"."Id" = "b3"."ItemId" ORDER BY "b4"."Id", "b0"."Id", "b0"."ItemId", "b1"."ItemId", "b1"."ProviderId", "b2"."Id", "b2"."ItemId", "u"."ItemId", "u"."UserId", "u"."CustomDataKey" For loading the library itself in 10.11 here is (logs of the thread? that handles) the request that never returns/finishes after 50 minutes: [02:24:30] [INF] [19] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory /media/tube [02:53:21] [INF] [19] Microsoft.AspNetCore.Hosting.Diagnostics: Request starting HTTP/1.0 GET http://jellyfin.local/Users/3746f94ab2094ee1b7d45300775081d1/Items?SortBy=DateCreated%2CSortName%2CProductionYear&SortOrder=Descending&IncludeItemTypes=Movie&Recursive=true&Fields=PrimaryImageAspectRatio%2CMediaSourceCount&ImageTypeLimit=1&EnableImageTypes=Primary%2CBackdrop%2CBanner%2CThumb&StartIndex=0&ParentId=34f331a89ce405e2b877d68d5ee4d4a2&Limit=100 - null null [02:53:21] [INF] [19] Microsoft.AspNetCore.Routing.EndpointMiddleware: Executing endpoint 'Jellyfin.Api.Controllers.ItemsController.GetItemsByUserIdLegacy (Jellyfin.Api)' [02:53:21] [INF] [19] Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Route matched with {action = "GetItemsByUserIdLegacy", controller = "Items"}. Executing controller action with signature Microsoft.AspNetCore.Mvc.ActionResult`1[MediaBrowser.Model.Querying.QueryResult`1[MediaBrowser.Model.Dto.BaseItemDto]] GetItemsByUserIdLegacy(System.Guid, System.String, System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Guid], System.Nullable`1[System.Int32], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], MediaBrowser.Model.Entities.LocationType[], MediaBrowser.Model.Entities.LocationType[], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Double], System.Nullable`1[System.Double], System.Nullable`1[System.DateTime], System.Nullable`1[System.DateTime], System.Nullable`1[System.DateTime], System.Nullable`1[System.DateTime], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Guid[], System.Nullable`1[System.Int32], System.Nullable`1[System.Int32], System.Nullable`1[System.Boolean], System.String, Jellyfin.Database.Implementations.Enums.SortOrder[], System.Nullable`1[System.Guid], MediaBrowser.Model.Querying.ItemFields[], Jellyfin.Data.Enums.BaseItemKind[], Jellyfin.Data.Enums.BaseItemKind[], MediaBrowser.Model.Querying.ItemFilter[], System.Nullable`1[System.Boolean], Jellyfin.Data.Enums.MediaType[], MediaBrowser.Model.Entities.ImageType[], Jellyfin.Data.Enums.ItemSortBy[], System.Nullable`1[System.Boolean], System.String[], System.String[], System.String[], Int32[], System.Nullable`1[System.Boolean], System.Nullable`1[System.Int32], MediaBrowser.Model.Entities.ImageType[], System.String, System.Guid[], System.String[], System.String[], System.String[], System.Guid[], System.Guid[], System.Guid[], System.Guid[], System.String[], System.Guid[], System.Guid[], MediaBrowser.Model.Entities.VideoType[], System.String, System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Int32], System.Nullable`1[System.Int32], System.Nullable`1[System.Int32], System.Nullable`1[System.Int32], System.Nullable`1[System.Boolean], MediaBrowser.Model.Entities.SeriesStatus[], System.String, System.String, System.String, System.Guid[], System.Guid[], Boolean, System.Nullable`1[System.Boolean]) on controller Jellyfin.Api.Controllers.ItemsController (Jellyfin.Api). ``` ### FFmpeg logs ```shell ``` ### Client / Browser logs _No response_ ### Relevant screenshots or videos _No response_ ### Additional information _No response_
backuprepo added the
area:database
bug
labels 2025-12-22 05:49:47 +01:00
Author
Owner

@kiawizard commented on GitHub (Oct 27, 2025):

I confirm this bug in 10.11.1 for libraries of type "other" (Mixed Movies and Shows) and "Home Videos and Photos". It takes 32 seconds to display a single level-1 subfolder in library. Ten level-2 subfolders won't ever show, will keep spinning and waiting for GetItemLegacy to finish.

Recreating library doesn't make it any better. There are only 200 videos in problematic library in 2 levels of subfolders. There are 130_000 BaseItems total in the database.

Have to revert to 10.10.7 for now

@kiawizard commented on GitHub (Oct 27, 2025): I confirm this bug in 10.11.1 for libraries of type "other" (Mixed Movies and Shows) and "Home Videos and Photos". It takes 32 seconds to display a single level-1 subfolder in library. Ten level-2 subfolders won't ever show, will keep spinning and waiting for GetItemLegacy to finish. Recreating library doesn't make it any better. There are only 200 videos in problematic library in 2 levels of subfolders. There are 130_000 BaseItems total in the database. Have to revert to 10.10.7 for now
Author
Owner

@kandykarter commented on GitHub (Oct 27, 2025):

I don't have any mixed or home video libraries, but this seems like it's probably the same issue I'm having with Collections #15090

@kandykarter commented on GitHub (Oct 27, 2025): I don't have any mixed or home video libraries, but this seems like it's probably the same issue I'm having with Collections #15090
Author
Owner

@monik3r commented on GitHub (Oct 29, 2025):

I don't have any mixed or home video libraries, but this seems like it's probably the same issue I'm having with Collections #15090

Would it be possible for you to see what is happening under the hood via the logs to confirm if it is the same? When initially checking I used docker logs jellyfin | grep "Executed DbCommand" -a5 to get the timings and some context for each.

To turn up logging you can use https://jellyfin.org/docs/general/administration/troubleshooting/#debug-logging

@monik3r commented on GitHub (Oct 29, 2025): > I don't have any mixed or home video libraries, but this seems like it's probably the same issue I'm having with Collections [#15090](https://github.com/jellyfin/jellyfin/issues/15090) Would it be possible for you to see what is happening under the hood via the logs to confirm if it is the same? When initially checking I used `docker logs jellyfin | grep "Executed DbCommand" -a5` to get the timings and some context for each. To turn up logging you can use https://jellyfin.org/docs/general/administration/troubleshooting/#debug-logging
Author
Owner

@kandykarter commented on GitHub (Oct 31, 2025):

I don't have any mixed or home video libraries, but this seems like it's probably the same issue I'm having with Collections #15090

Would it be possible for you to see what is happening under the hood via the logs to confirm if it is the same? When initially checking I used docker logs jellyfin | grep "Executed DbCommand" -a5 to get the timings and some context for each.

To turn up logging you can use https://jellyfin.org/docs/general/administration/troubleshooting/#debug-logging

Guess it was a false alarm, that command outputs nothing. Thanks!

@kandykarter commented on GitHub (Oct 31, 2025): > > I don't have any mixed or home video libraries, but this seems like it's probably the same issue I'm having with Collections [#15090](https://github.com/jellyfin/jellyfin/issues/15090) > > Would it be possible for you to see what is happening under the hood via the logs to confirm if it is the same? When initially checking I used `docker logs jellyfin | grep "Executed DbCommand" -a5` to get the timings and some context for each. > > To turn up logging you can use https://jellyfin.org/docs/general/administration/troubleshooting/#debug-logging Guess it was a false alarm, that command outputs nothing. Thanks!
Author
Owner

@monik3r commented on GitHub (Oct 31, 2025):

I don't have any mixed or home video libraries, but this seems like it's probably the same issue I'm having with Collections #15090

Would it be possible for you to see what is happening under the hood via the logs to confirm if it is the same? When initially checking I used docker logs jellyfin | grep "Executed DbCommand" -a5 to get the timings and some context for each.
To turn up logging you can use https://jellyfin.org/docs/general/administration/troubleshooting/#debug-logging

Guess it was a false alarm, that command outputs nothing. Thanks!

If it doesn't output anything, then you aren't getting logs with details about DbCommand, not necessarily that it isn't the same issue. I also don't get the log line when the DbCommand doesn't finish.

@monik3r commented on GitHub (Oct 31, 2025): > > > I don't have any mixed or home video libraries, but this seems like it's probably the same issue I'm having with Collections [#15090](https://github.com/jellyfin/jellyfin/issues/15090) > > > > > > Would it be possible for you to see what is happening under the hood via the logs to confirm if it is the same? When initially checking I used `docker logs jellyfin | grep "Executed DbCommand" -a5` to get the timings and some context for each. > > To turn up logging you can use https://jellyfin.org/docs/general/administration/troubleshooting/#debug-logging > > Guess it was a false alarm, that command outputs nothing. Thanks! If it doesn't output anything, then you aren't getting logs with details about DbCommand, not necessarily that it isn't the same issue. I also don't get the log line when the DbCommand doesn't finish.
Author
Owner

@kandykarter commented on GitHub (Oct 31, 2025):

Fair enough! I updated my issue with some weird stuff I did see in the debug logs, but definitely nothing with DbCommand.

@kandykarter commented on GitHub (Oct 31, 2025): Fair enough! I updated my issue with some weird stuff I *did* see in the debug logs, but definitely nothing with DbCommand.
Author
Owner

@pelluch commented on GitHub (Nov 11, 2025):

I posted a comment in https://github.com/jellyfin/jellyfin/issues/15090 where I attached a log and some context from a single collections call. It made about 1,391 queries (as counted by "Executed DbCommand").

@pelluch commented on GitHub (Nov 11, 2025): I posted a comment in https://github.com/jellyfin/jellyfin/issues/15090 where I attached a log and some context from a single collections call. It made about 1,391 queries (as counted by "Executed DbCommand").
Author
Owner

@monik3r commented on GitHub (Nov 17, 2025):

Tested with a fresh install of 10.11.3 with just the single library and user, no improvement/change.

@monik3r commented on GitHub (Nov 17, 2025): Tested with a fresh install of 10.11.3 with just the single library and user, no improvement/change.
Author
Owner

@monik3r commented on GitHub (Nov 17, 2025):

I posted a comment in #15090 where I attached a log and some context from a single collections call. It made about 1,391 queries (as counted by "Executed DbCommand").

You seem to be having the same/a similar issue:

cat ~/Downloads/jellyfin.log | grep -i GetItemsByUserIdLegacy
[17:55:32] [INF] [38] Microsoft.AspNetCore.Routing.EndpointMiddleware: Executing endpoint 'Jellyfin.Api.Controllers.ItemsController.GetItemsByUserIdLegacy (Jellyfin.Api)'
[17:55:32] [INF] [38] Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Route matched with {action = "GetItemsByUserIdLegacy", controller = "Items"}. Executing controller action with signature Microsoft.AspNetCore.Mvc.ActionResult`1[MediaBrowser.Model.Querying.QueryResult`1[MediaBrowser.Model.Dto.BaseItemDto]] GetItemsByUserIdLegacy(System.Guid, System.String, System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Guid], System.Nullable`1[System.Int32], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], MediaBrowser.Model.Entities.LocationType[], MediaBrowser.Model.Entities.LocationType[], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Double], System.Nullable`1[System.Double], System.Nullable`1[System.DateTime], System.Nullable`1[System.DateTime], System.Nullable`1[System.DateTime], System.Nullable`1[System.DateTime], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Guid[], System.Nullable`1[System.Int32], System.Nullable`1[System.Int32], System.Nullable`1[System.Boolean], System.String, Jellyfin.Database.Implementations.Enums.SortOrder[], System.Nullable`1[System.Guid], MediaBrowser.Model.Querying.ItemFields[], Jellyfin.Data.Enums.BaseItemKind[], Jellyfin.Data.Enums.BaseItemKind[], MediaBrowser.Model.Querying.ItemFilter[], System.Nullable`1[System.Boolean], Jellyfin.Data.Enums.MediaType[], MediaBrowser.Model.Entities.ImageType[], Jellyfin.Data.Enums.ItemSortBy[], System.Nullable`1[System.Boolean], System.String[], System.String[], System.String[], Int32[], System.Nullable`1[System.Boolean], System.Nullable`1[System.Int32], MediaBrowser.Model.Entities.ImageType[], System.String, System.Guid[], System.String[], System.String[], System.String[], System.Guid[], System.Guid[], System.Guid[], System.Guid[], System.String[], System.Guid[], System.Guid[], MediaBrowser.Model.Entities.VideoType[], System.String, System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Int32], System.Nullable`1[System.Int32], System.Nullable`1[System.Int32], System.Nullable`1[System.Int32], System.Nullable`1[System.Boolean], MediaBrowser.Model.Entities.SeriesStatus[], System.String, System.String, System.String, System.Guid[], System.Guid[], Boolean, System.Nullable`1[System.Boolean]) on controller Jellyfin.Api.Controllers.ItemsController (Jellyfin.Api).
[17:55:34] [INF] [38] Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Executed action Jellyfin.Api.Controllers.ItemsController.GetItemsByUserIdLegacy (Jellyfin.Api) in 2244.3337ms
[17:55:34] [INF] [38] Microsoft.AspNetCore.Routing.EndpointMiddleware: Executed endpoint 'Jellyfin.Api.Controllers.ItemsController.GetItemsByUserIdLegacy (Jellyfin.Api)'

Note the 2244.3337ms. It is a bit faster than my library (mine doesn't finish after hours!), but that is still extremely slow WRT the 10.11 vs 10.10.

Sadly reinstalling 10.11.0 or 10.11 from scratch did not help here.

@monik3r commented on GitHub (Nov 17, 2025): > I posted a comment in [#15090](https://github.com/jellyfin/jellyfin/issues/15090) where I attached a log and some context from a single collections call. It made about 1,391 queries (as counted by "Executed DbCommand"). You seem to be having the same/a similar issue: ``` cat ~/Downloads/jellyfin.log | grep -i GetItemsByUserIdLegacy [17:55:32] [INF] [38] Microsoft.AspNetCore.Routing.EndpointMiddleware: Executing endpoint 'Jellyfin.Api.Controllers.ItemsController.GetItemsByUserIdLegacy (Jellyfin.Api)' [17:55:32] [INF] [38] Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Route matched with {action = "GetItemsByUserIdLegacy", controller = "Items"}. Executing controller action with signature Microsoft.AspNetCore.Mvc.ActionResult`1[MediaBrowser.Model.Querying.QueryResult`1[MediaBrowser.Model.Dto.BaseItemDto]] GetItemsByUserIdLegacy(System.Guid, System.String, System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Guid], System.Nullable`1[System.Int32], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], MediaBrowser.Model.Entities.LocationType[], MediaBrowser.Model.Entities.LocationType[], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Double], System.Nullable`1[System.Double], System.Nullable`1[System.DateTime], System.Nullable`1[System.DateTime], System.Nullable`1[System.DateTime], System.Nullable`1[System.DateTime], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Guid[], System.Nullable`1[System.Int32], System.Nullable`1[System.Int32], System.Nullable`1[System.Boolean], System.String, Jellyfin.Database.Implementations.Enums.SortOrder[], System.Nullable`1[System.Guid], MediaBrowser.Model.Querying.ItemFields[], Jellyfin.Data.Enums.BaseItemKind[], Jellyfin.Data.Enums.BaseItemKind[], MediaBrowser.Model.Querying.ItemFilter[], System.Nullable`1[System.Boolean], Jellyfin.Data.Enums.MediaType[], MediaBrowser.Model.Entities.ImageType[], Jellyfin.Data.Enums.ItemSortBy[], System.Nullable`1[System.Boolean], System.String[], System.String[], System.String[], Int32[], System.Nullable`1[System.Boolean], System.Nullable`1[System.Int32], MediaBrowser.Model.Entities.ImageType[], System.String, System.Guid[], System.String[], System.String[], System.String[], System.Guid[], System.Guid[], System.Guid[], System.Guid[], System.String[], System.Guid[], System.Guid[], MediaBrowser.Model.Entities.VideoType[], System.String, System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Boolean], System.Nullable`1[System.Int32], System.Nullable`1[System.Int32], System.Nullable`1[System.Int32], System.Nullable`1[System.Int32], System.Nullable`1[System.Boolean], MediaBrowser.Model.Entities.SeriesStatus[], System.String, System.String, System.String, System.Guid[], System.Guid[], Boolean, System.Nullable`1[System.Boolean]) on controller Jellyfin.Api.Controllers.ItemsController (Jellyfin.Api). [17:55:34] [INF] [38] Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Executed action Jellyfin.Api.Controllers.ItemsController.GetItemsByUserIdLegacy (Jellyfin.Api) in 2244.3337ms [17:55:34] [INF] [38] Microsoft.AspNetCore.Routing.EndpointMiddleware: Executed endpoint 'Jellyfin.Api.Controllers.ItemsController.GetItemsByUserIdLegacy (Jellyfin.Api)' ``` Note the 2244.3337ms. It is a bit faster than my library (mine doesn't finish after hours!), but that is still extremely slow WRT the 10.11 vs 10.10. Sadly reinstalling 10.11.0 or 10.11 from scratch did not help here.
Author
Owner

@pelluch commented on GitHub (Nov 25, 2025):

@monik3r While I intend on investigating the underlying issue, since this is a problem massively hindering a lot of people, I spent some time making a small plugin, Disable User Data, which is meant to serve as a mitigation in the meantime. The README in that repo explains what it does in much more detail, but in essence it allows one to disable user data on a few endpoints, which greatly speeds up some cases using GetLatestMediaLegacy or GetItemsByUserIdLegacy (and several others).

To test it, I created a collection with my entire library. Going to "Collections" without the plugin takes ~13s-18s to load, but with it, ~1s. You should hopefully see similar speed ups if your home section is what's causing the issue (just configure the plugin in its settings). I should note that while loading the general collections view was much faster, going into the giant collection itself didn't show visible improvement, mostly because Jellyfin tries to get the information about thousands of items all at once.

If you or anyone are curious to give it a try, I'd be very curious to hear what sort of improvements people are getting and from what - it would help steer optimization efforts, though the user data part seems an obvious place to try.

@pelluch commented on GitHub (Nov 25, 2025): @monik3r While I intend on investigating the underlying issue, since this is a problem massively hindering a lot of people, I spent some time making a small plugin, [Disable User Data](https://github.com/pelluch/jellyfin-plugin-disable-user-data), which is meant to serve as a mitigation in the meantime. The README in that repo explains what it does in much more detail, but in essence it allows one to disable user data on a few endpoints, which greatly speeds up some cases using `GetLatestMediaLegacy` or `GetItemsByUserIdLegacy` (and several others). To test it, I created a collection with my entire library. Going to "Collections" without the plugin takes ~13s-18s to load, but with it, ~1s. You should hopefully see similar speed ups if your home section is what's causing the issue (just configure the plugin in its settings). I should note that while loading the general collections view was much faster, going into the giant collection itself didn't show visible improvement, mostly because Jellyfin tries to get the information about thousands of items all at once. If you or anyone are curious to give it a try, I'd be very curious to hear what sort of improvements people are getting and from what - it would help steer optimization efforts, though the user data part seems an obvious place to try.
Author
Owner

@kiawizard commented on GitHub (Nov 25, 2025):

@pelluch Thanks for your work! I have tested your plugin (all checkboxes checked in settings) and found that there is still an api call which takes enormous time:

/Users/bb233bd50fb94798b49763fff4c25640/Items?StartIndex=0&Limit=100&Fields=PrimaryImageAspectRatio%2CSortName%2CPath%2CChildCount%2CMediaSourceCount%2CPrimaryImageAspectRatio&ImageTypeLimit=1&ParentId=956b68e9adc2a5b1b856cbf288fdb1a4&SortBy=IsFolder%2CSortName&SortOrder=Ascending

Example reply:

{
    "Items": [
        {
            "Name": "..............",
            "ServerId": "9dd2c629198e47a4856e8c0fe028b50a",
            "Id": "ae1514eb0094dc827ed8fb06b4336284",
            "SortName": "0000000000 trailers",
            "Path": "...............",
            "ChannelId": null,
            "IsFolder": true,
            "Type": "PhotoAlbum",
            "UserData": {
                "PlaybackPositionTicks": 0,
                "PlayCount": 0,
                "IsFavorite": false,
                "Played": false,
                "Key": "ae1514eb-0094-dc82-7ed8-fb06b4336284",
                "ItemId": "ae1514eb0094dc827ed8fb06b4336284"
            },
            "ChildCount": 29,
            "PrimaryImageAspectRatio": 1.7777777777777777,
            "ImageTags": {
                "Primary": "a62efa7343ed4fcb2546ba9d85fabad2"
            },
            "BackdropImageTags": [],
            "ImageBlurHashes": {
                "Primary": {
                    "a62efa7343ed4fcb2546ba9d85fabad2": "WGFYiQ~qt8%2xuxGx[W:Riaxxuoe9ED$D%M{smR*k7M{WBM{IURj"
                }
            },
            "LocationType": "FileSystem",
            "MediaType": "Unknown"
        },

This is called on entering a folder inside a library. Could you update the plugin to disable UserData for this api endpoint too?

@kiawizard commented on GitHub (Nov 25, 2025): @pelluch Thanks for your work! I have tested your plugin (all checkboxes checked in settings) and found that there is still an api call which takes enormous time: /Users/bb233bd50fb94798b49763fff4c25640/Items?StartIndex=0&Limit=100&Fields=PrimaryImageAspectRatio%2CSortName%2CPath%2CChildCount%2CMediaSourceCount%2CPrimaryImageAspectRatio&ImageTypeLimit=1&ParentId=956b68e9adc2a5b1b856cbf288fdb1a4&SortBy=IsFolder%2CSortName&SortOrder=Ascending Example reply: ``` { "Items": [ { "Name": "..............", "ServerId": "9dd2c629198e47a4856e8c0fe028b50a", "Id": "ae1514eb0094dc827ed8fb06b4336284", "SortName": "0000000000 trailers", "Path": "...............", "ChannelId": null, "IsFolder": true, "Type": "PhotoAlbum", "UserData": { "PlaybackPositionTicks": 0, "PlayCount": 0, "IsFavorite": false, "Played": false, "Key": "ae1514eb-0094-dc82-7ed8-fb06b4336284", "ItemId": "ae1514eb0094dc827ed8fb06b4336284" }, "ChildCount": 29, "PrimaryImageAspectRatio": 1.7777777777777777, "ImageTags": { "Primary": "a62efa7343ed4fcb2546ba9d85fabad2" }, "BackdropImageTags": [], "ImageBlurHashes": { "Primary": { "a62efa7343ed4fcb2546ba9d85fabad2": "WGFYiQ~qt8%2xuxGx[W:Riaxxuoe9ED$D%M{smR*k7M{WBM{IURj" } }, "LocationType": "FileSystem", "MediaType": "Unknown" }, ``` This is called on entering a folder inside a library. Could you update the plugin to disable UserData for this api endpoint too?
Author
Owner

@pelluch commented on GitHub (Nov 25, 2025):

@kiawizard Yeah, it should be pretty easy to add now that the framework is established - I'll get a quick update published during the day with the option to do so for general folders. It's not a guarantee that it will massively speed it up, but it certainly can't hurt to try, and from your JSON UserData is there so it's likely a factor anyway. I'll give an update here when that's done.

@pelluch commented on GitHub (Nov 25, 2025): @kiawizard Yeah, it should be pretty easy to add now that the framework is established - I'll get a quick update published during the day with the option to do so for general folders. It's not a guarantee that it will massively speed it up, but it certainly can't hurt to try, and from your JSON `UserData` is there so it's likely a factor anyway. I'll give an update here when that's done.
Author
Owner

@kiawizard commented on GitHub (Nov 26, 2025):

@pelluch Thanks a lot! Finally with version 0.2.1.1 of your Disable User Data plugin Jellyfin 10.11 started to work

@kiawizard commented on GitHub (Nov 26, 2025): @pelluch Thanks a lot! Finally with version 0.2.1.1 of your Disable User Data plugin Jellyfin 10.11 started to work
Author
Owner

@pelluch commented on GitHub (Nov 27, 2025):

@kiawizard I'm happy to hear! I included a more encompassing option that allows disabling for all /Items APIs, as there are many types of media (collections, photos, movies, shows, live TV, music etc). Did it make a noticeable change for you?

I am thinking about improving it by allowing users to directly select or type all of the places they want to apply it to, while keeping the "catch-all" option I added.

@pelluch commented on GitHub (Nov 27, 2025): @kiawizard I'm happy to hear! I included a more encompassing option that allows disabling for all /Items APIs, as there are many types of media (collections, photos, movies, shows, live TV, music etc). Did it make a noticeable change for you? I am thinking about improving it by allowing users to directly select or type all of the places they want to apply it to, while keeping the "catch-all" option I added.
Author
Owner

@kiawizard commented on GitHub (Nov 27, 2025):

Did it make a noticeable change for you?

Sure it did, libraries of type "Home Videos and Photos" which I use for all media without metadata from the internet started to open with this option. Before there was an endless waiting on entering such libraries and folders inside them

@kiawizard commented on GitHub (Nov 27, 2025): > Did it make a noticeable change for you? Sure it did, libraries of type "Home Videos and Photos" which I use for all media without metadata from the internet started to open with this option. Before there was an endless waiting on entering such libraries and folders inside them
Author
Owner

@kiawizard commented on GitHub (Dec 1, 2025):

Finally my issue with folders opening forever returned. Without any changes to the content, with pelluch's plugin running. I downloaded the source code, edited MediaBrowser.Controller\Entities\Folder.cs , turned off GetRecursiveChildCount:

public virtual int GetRecursiveChildCount(User user)
{
    return 0;
}

then built release, copied MediaBrowser.Controller.dll into 10.11.4 folder, and it works again

@kiawizard commented on GitHub (Dec 1, 2025): Finally my issue with folders opening forever returned. Without any changes to the content, with pelluch's plugin running. I downloaded the source code, edited MediaBrowser.Controller\Entities\Folder.cs , turned off GetRecursiveChildCount: ``` public virtual int GetRecursiveChildCount(User user) { return 0; } ``` then built release, copied MediaBrowser.Controller.dll into 10.11.4 folder, and it works again
Author
Owner

@rushiiMachine commented on GitHub (Dec 5, 2025):

@pelluch Thank you very much for the workaround! I have a Music library containing 680 albums/8900 tracks, and this massively improved the speed for listing items, and searching! With my Raspi 3B+ already being so resource-constrained, searching previously completely froze Jellyfin for multiple minutes, but now it's down to a few seconds, with listing items down from over a minute to just 2.5s!

@rushiiMachine commented on GitHub (Dec 5, 2025): @pelluch Thank you very much for the workaround! I have a Music library containing 680 albums/8900 tracks, and this massively improved the speed for listing items, and searching! With my Raspi 3B+ already being so resource-constrained, searching previously completely froze Jellyfin for multiple minutes, but now it's down to a few seconds, with listing items down from over a minute to just 2.5s!
Author
Owner

@cvium commented on GitHub (Dec 6, 2025):

Are the collections also slow when they only contain movies (no boxsets or other groupings)?

@cvium commented on GitHub (Dec 6, 2025): Are the collections also slow when they only contain movies (no boxsets or other groupings)?
Author
Owner

@kandykarter commented on GitHub (Dec 6, 2025):

@cvium In my case, yes. The Collections library on my server is movie-exclusive. However, there is an odd behaviour I've recently observed. Clicking into "Collections" from the main homepage takes ~10 seconds longer to load than it does if I click into it from the topbar inside the Movies library, even though no Collections contain any TV shows (and there's no other types of media on my server).

@kandykarter commented on GitHub (Dec 6, 2025): @cvium In my case, yes. The Collections library on my server is movie-exclusive. However, there is an odd behaviour I've recently observed. Clicking into "Collections" from the main homepage takes ~10 seconds longer to load than it does if I click into it from the topbar inside the Movies library, even though no Collections contain any TV shows (and there's no other types of media on my server).
Author
Owner

@monik3r commented on GitHub (Dec 6, 2025):

Are the collections also slow when they only contain movies (no boxsets or other groupings)?

There are no boxsets or groupings that I have set up. The folder structure for my problem library is:

.
├── channel_id
│   ├── video1_id.mp4
│   ├── video1_id.nfo
│   ├── video1_id.png
│   ├── video2_id.mp4
│   ├── video2_id.nfo
│   ├── video2_id.png
...

Where channel_id is the YouTube channel ID, and the video IDs are the YouTube video IDs.

@monik3r commented on GitHub (Dec 6, 2025): > Are the collections also slow when they only contain movies (no boxsets or other groupings)? There are no boxsets or groupings that I have set up. The folder structure for my problem library is: ``` . ├── channel_id │   ├── video1_id.mp4 │   ├── video1_id.nfo │   ├── video1_id.png │   ├── video2_id.mp4 │   ├── video2_id.nfo │   ├── video2_id.png ... ``` Where channel_id is the YouTube channel ID, and the video IDs are the YouTube video IDs.
Author
Owner

@cvium commented on GitHub (Dec 7, 2025):

Which database locking strategy are you using?

@cvium commented on GitHub (Dec 7, 2025): Which database locking strategy are you using?
Author
Owner

@kandykarter commented on GitHub (Dec 7, 2025):

Optimistic here.

@kandykarter commented on GitHub (Dec 7, 2025): Optimistic here.
Author
Owner

@cvium commented on GitHub (Dec 7, 2025):

How many of your collections are empty?

@cvium commented on GitHub (Dec 7, 2025): How many of your collections are empty?
Author
Owner

@kandykarter commented on GitHub (Dec 7, 2025):

None as far as I know.

@kandykarter commented on GitHub (Dec 7, 2025): None as far as I know.
Author
Owner

@monik3r commented on GitHub (Dec 7, 2025):

Also no empty collections, I did not change or manually set the locking strategy.

@monik3r commented on GitHub (Dec 7, 2025): Also no empty collections, I did not change or manually set the locking strategy.
Author
Owner

@cvium commented on GitHub (Dec 7, 2025):

My 96 collections take about 800ms to load, which isn't fast, but not unreasonably slow. Removing the empty ones takes it down to 500-600 ms (different code path for empty ones -- seems unintentional). I think my DB isn't big enough to really reproduce it.
If you can (and want to, it's privacy concern for some), send me your DBs in a DM on Matrix (or if you have other suitable ways).

@cvium commented on GitHub (Dec 7, 2025): My 96 collections take about 800ms to load, which isn't fast, but not unreasonably slow. Removing the empty ones takes it down to 500-600 ms (different code path for empty ones -- seems unintentional). I think my DB isn't big enough to really reproduce it. If you can (and want to, it's privacy concern for some), send me your DBs in a DM on Matrix (or if you have other suitable ways).
Author
Owner

@kandykarter commented on GitHub (Dec 7, 2025):

I don't have matrix (and it doesn't look like I can do it through discord) and my db is around 500mb, not sure about an easy way to get it to you

edit: I'm going to send a link in a PM to you on the Jellyfin forums, let me know if that doesn't work for you

@kandykarter commented on GitHub (Dec 7, 2025): I don't have matrix (and it doesn't look like I can do it through discord) and my db is around 500mb, not sure about an easy way to get it to you edit: I'm going to send a link in a PM to you on the Jellyfin forums, let me know if that doesn't work for you
Author
Owner

@FrankJeager commented on GitHub (Dec 13, 2025):

Thanks to the OP queries in the logs I've been profiling the GetLatestItems SQL generation and noticed a couple of things really killing performance on large libraries.
First, the query is slow because of the multiple one-to-many Include calls (Images, Trailers, Providers) happening. For a request of 80 items, the DB is returning thousands of rows that EF core has to deduplicate in memory. This spikes both network I/O and RAM usage unnecessarily.
One of the possible fix is in BaseItemRepository.cs. We just need to force split queries:


public IReadOnlyList<BaseItemDto> GetItemList(InternalItemsQuery filter)
    {
        ...

        return dbQuery.AsSplitQuery().AsEnumerable().Where(e => e is not null).Select(w => DeserializeBaseItem(w, filter.SkipDeserialization)).ToArray();
    }

public IReadOnlyList<BaseItem> GetLatestItemList(InternalItemsQuery filter, CollectionType collectionType)
   {
        ...

        return mainquery.AsSplitQuery().AsEnumerable().Where(e => e is not null).Select(w => DeserializeBaseItem(w, filter.SkipDeserialization)).ToArray();
    }


Another fix could be in TranslateQuery around the IsPlayed filter. Currently, it generates a correlated subquery in the WHERE clause (the COALESCE) which runs for every single row scanned.
Refactoring this to use .Any() allows EF core to generate a proper EXISTS or LEFT JOIN, which is much friendlier on the execution plan:


if (filter.IsPlayed.HasValue)
{
    if (filter.IncludeItemTypes.Length == 1 && filter.IncludeItemTypes[0] == BaseItemKind.Series)
    {
        baseQuery = baseQuery.Where(e => context.BaseItems.Where(e => e.Id != EF.Constant(PlaceholderId))
            .Where(e => e.IsFolder == false && e.IsVirtualItem == false)
            .Where(f => f.UserData!.FirstOrDefault(e => e.UserId == filter.User!.Id && e.Played)!.Played)
            .Any(f => f.SeriesPresentationUniqueKey == e.PresentationUniqueKey) == filter.IsPlayed);
    }
    else
    {
        var userId = filter.User!.Id;

        if (filter.IsPlayed.Value)
        {
            baseQuery = baseQuery.Where(e => e.UserData!.Any(u => u.UserId == userId && u.Played));
        }
        else
        {
            baseQuery = baseQuery.Where(e => !e.UserData!.Any(u => u.UserId == userId && u.Played));
        }
    }
}

These two changes should drastically drop the execution time and memory footprint if i'm correct...
But I've not the time to test them. So if someone with time and good will would accept to test it I will be glad.

@FrankJeager commented on GitHub (Dec 13, 2025): Thanks to the OP queries in the logs I've been profiling the GetLatestItems SQL generation and noticed a couple of things really killing performance on large libraries. First, the query is slow because of the multiple one-to-many Include calls (Images, Trailers, Providers) happening. For a request of 80 items, the DB is returning thousands of rows that EF core has to deduplicate in memory. This spikes both network I/O and RAM usage unnecessarily. One of the possible fix is in BaseItemRepository.cs. We just need to force split queries: ``` public IReadOnlyList<BaseItemDto> GetItemList(InternalItemsQuery filter) { ... return dbQuery.AsSplitQuery().AsEnumerable().Where(e => e is not null).Select(w => DeserializeBaseItem(w, filter.SkipDeserialization)).ToArray(); } public IReadOnlyList<BaseItem> GetLatestItemList(InternalItemsQuery filter, CollectionType collectionType) { ... return mainquery.AsSplitQuery().AsEnumerable().Where(e => e is not null).Select(w => DeserializeBaseItem(w, filter.SkipDeserialization)).ToArray(); } ``` Another fix could be in TranslateQuery around the IsPlayed filter. Currently, it generates a correlated subquery in the WHERE clause (the COALESCE) which runs for every single row scanned. Refactoring this to use .Any() allows EF core to generate a proper EXISTS or LEFT JOIN, which is much friendlier on the execution plan: ``` if (filter.IsPlayed.HasValue) { if (filter.IncludeItemTypes.Length == 1 && filter.IncludeItemTypes[0] == BaseItemKind.Series) { baseQuery = baseQuery.Where(e => context.BaseItems.Where(e => e.Id != EF.Constant(PlaceholderId)) .Where(e => e.IsFolder == false && e.IsVirtualItem == false) .Where(f => f.UserData!.FirstOrDefault(e => e.UserId == filter.User!.Id && e.Played)!.Played) .Any(f => f.SeriesPresentationUniqueKey == e.PresentationUniqueKey) == filter.IsPlayed); } else { var userId = filter.User!.Id; if (filter.IsPlayed.Value) { baseQuery = baseQuery.Where(e => e.UserData!.Any(u => u.UserId == userId && u.Played)); } else { baseQuery = baseQuery.Where(e => !e.UserData!.Any(u => u.UserId == userId && u.Played)); } } } ``` These two changes should drastically drop the execution time and memory footprint if i'm correct... But I've not the time to test them. So if someone with time and good will would accept to test it I will be glad.
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#7462
No description provided.