diff options
| author | KGT1 <kilian.gamn@gmx.de> | 2026-10-17 16:51:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-10-17 16:51:55 +0200 |
| commit | 292b13d1daf36316274211a8b3c13385c60efdb5 (patch) | |
| tree | 1204df8423af2f317dbf3171aa7a42b1413b4e2e /src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/BaseItemConfiguration.cs | |
| parent | 0be145c4e202bac0edc36b769f8b4db2232ad216 (diff) | |
| parent | 08c2ba6e0b6499122822f1c5b18bc426104538b4 (diff) | |
Merge branch 'jellyfin:master' into removeGenericConfigurationEndpoint
Diffstat (limited to 'src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/BaseItemConfiguration.cs')
| -rw-r--r-- | src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/BaseItemConfiguration.cs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/BaseItemConfiguration.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/BaseItemConfiguration.cs index 8556fb7bb3..9e846056ac 100644 --- a/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/BaseItemConfiguration.cs +++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/BaseItemConfiguration.cs @@ -35,9 +35,11 @@ public class BaseItemConfiguration : IEntityTypeConfiguration<BaseItemEntity> builder.HasIndex(e => e.Path); builder.HasIndex(e => e.ParentId); - builder.HasIndex(e => e.OwnerId); + builder.HasIndex(e => e.OwnerId) + .HasFilter("\"OwnerId\" IS NOT NULL"); builder.HasIndex(e => e.Name); - builder.HasIndex(e => new { e.ExtraType, e.OwnerId }); + builder.HasIndex(e => new { e.ExtraType, e.OwnerId }) + .HasFilter("\"ExtraType\" IS NOT NULL"); builder.HasIndex(e => e.PresentationUniqueKey); // covering index builder.HasIndex(e => new { e.TopParentId, e.Id }); @@ -61,6 +63,11 @@ public class BaseItemConfiguration : IEntityTypeConfiguration<BaseItemEntity> builder.HasIndex(e => new { e.TopParentId, e.MediaType, e.IsVirtualItem, e.DateCreated }); // resume builder.HasIndex(e => new { e.MediaType, e.TopParentId, e.IsVirtualItem, e.PresentationUniqueKey }); + // alternate versions of an item, e.g. resolving the played date of a version onto its primary. + // Filtered: almost no item has a primary version, and an index covering those rows too would tempt + // the planner into serving "PrimaryVersionId IS NULL" - true for the whole library - out of it. + builder.HasIndex(e => e.PrimaryVersionId) + .HasFilter("\"PrimaryVersionId\" IS NOT NULL"); // sorted library queries (e.g., Series sorted by SortName) builder.HasIndex(e => new { e.Type, e.TopParentId, e.SortName }); // NextUp: per-series episode ordering (index seek + range scan on season/episode) |
