Fix Playlist and Boxset query and count perf

This commit is contained in:
Shadowghost
2026-05-04 10:22:13 +02:00
parent 622947e374
commit fa65a392b0
7 changed files with 1949 additions and 19 deletions
@@ -73,6 +73,10 @@ public class BaseItemConfiguration : IEntityTypeConfiguration<BaseItemEntity>
builder.HasIndex(e => e.SeasonId);
builder.HasIndex(e => e.SeriesId);
// Items/Counts: SELECT Type, COUNT(*) GROUP BY Type filtered by TopParentId.
builder.HasIndex(e => new { e.TopParentId, e.Type, e.IsVirtualItem })
.HasFilter("\"PrimaryVersionId\" IS NULL AND (\"OwnerId\" IS NULL OR \"ExtraType\" IS NOT NULL)");
builder.HasData(new BaseItemEntity()
{
Id = Guid.Parse("00000000-0000-0000-0000-000000000001"),