Make the media stream filter index covering
This commit is contained in:
+4
-1
@@ -13,6 +13,9 @@ public class MediaStreamInfoConfiguration : IEntityTypeConfiguration<MediaStream
|
||||
public void Configure(EntityTypeBuilder<MediaStreamInfo> builder)
|
||||
{
|
||||
builder.HasKey(e => new { e.ItemId, e.StreamIndex });
|
||||
builder.HasIndex(e => new { e.StreamType, e.ItemId });
|
||||
|
||||
// Covering index for the stream filters. ItemId comes second because it is what they project and
|
||||
// dedupe on; Language and IsExternal follow only to keep their predicates off the table.
|
||||
builder.HasIndex(e => new { e.StreamType, e.ItemId, e.Language, e.IsExternal });
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -11,8 +11,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
namespace Jellyfin.Database.Providers.Sqlite.Migrations
|
||||
{
|
||||
[DbContext(typeof(JellyfinDbContext))]
|
||||
[Migration("20260811145224_AddMediaStreamTypeItemIdIndex")]
|
||||
partial class AddMediaStreamTypeItemIdIndex
|
||||
[Migration("20260812050902_AddMediaStreamFilterIndex")]
|
||||
partial class AddMediaStreamFilterIndex
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@@ -1015,7 +1015,7 @@ namespace Jellyfin.Database.Providers.Sqlite.Migrations
|
||||
|
||||
b.HasKey("ItemId", "StreamIndex");
|
||||
|
||||
b.HasIndex("StreamType", "ItemId");
|
||||
b.HasIndex("StreamType", "ItemId", "Language", "IsExternal");
|
||||
|
||||
b.ToTable("MediaStreamInfos");
|
||||
|
||||
+5
-5
@@ -1,26 +1,26 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Jellyfin.Database.Providers.Sqlite.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddMediaStreamTypeItemIdIndex : Migration
|
||||
public partial class AddMediaStreamFilterIndex : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MediaStreamInfos_StreamType_ItemId",
|
||||
name: "IX_MediaStreamInfos_StreamType_ItemId_Language_IsExternal",
|
||||
table: "MediaStreamInfos",
|
||||
columns: ["StreamType", "ItemId"]);
|
||||
columns: new[] { "StreamType", "ItemId", "Language", "IsExternal" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_MediaStreamInfos_StreamType_ItemId",
|
||||
name: "IX_MediaStreamInfos_StreamType_ItemId_Language_IsExternal",
|
||||
table: "MediaStreamInfos");
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1012,7 +1012,7 @@ namespace Jellyfin.Server.Implementations.Migrations
|
||||
|
||||
b.HasKey("ItemId", "StreamIndex");
|
||||
|
||||
b.HasIndex("StreamType", "ItemId");
|
||||
b.HasIndex("StreamType", "ItemId", "Language", "IsExternal");
|
||||
|
||||
b.ToTable("MediaStreamInfos");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user