mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-20 07:37:03 +01:00
Fix Playlist and Boxset query and count perf
This commit is contained in:
@@ -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"),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Jellyfin.Database.Providers.Sqlite.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddPartialIndexForItemCounts : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BaseItems_TopParentId_Type_IsVirtualItem",
|
||||
table: "BaseItems",
|
||||
columns: new[] { "TopParentId", "Type", "IsVirtualItem" },
|
||||
filter: "\"PrimaryVersionId\" IS NULL AND (\"OwnerId\" IS NULL OR \"ExtraType\" IS NOT NULL)");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_BaseItems_TopParentId_Type_IsVirtualItem",
|
||||
table: "BaseItems");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace Jellyfin.Server.Implementations.Migrations
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "10.0.3");
|
||||
modelBuilder.HasAnnotation("ProductVersion", "10.0.7");
|
||||
|
||||
modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AccessSchedule", b =>
|
||||
{
|
||||
@@ -382,6 +382,9 @@ namespace Jellyfin.Server.Implementations.Migrations
|
||||
|
||||
b.HasIndex("Type", "CleanName");
|
||||
|
||||
b.HasIndex("TopParentId", "Type", "IsVirtualItem")
|
||||
.HasFilter("\"PrimaryVersionId\" IS NULL AND (\"OwnerId\" IS NULL OR \"ExtraType\" IS NOT NULL)");
|
||||
|
||||
b.HasIndex("Type", "TopParentId", "Id");
|
||||
|
||||
b.HasIndex("Type", "TopParentId", "PresentationUniqueKey");
|
||||
|
||||
Reference in New Issue
Block a user