add index to last connection for improved search speed

This commit is contained in:
RaidMax 2023-01-23 21:10:33 -06:00
parent b002991686
commit 8f20a2e2cd
10 changed files with 5058 additions and 1 deletions

View File

@ -88,7 +88,8 @@ namespace Data.Context
// make network id unique // make network id unique
modelBuilder.Entity<EFClient>(entity => modelBuilder.Entity<EFClient>(entity =>
{ {
entity.HasIndex(e => e.NetworkId); entity.HasIndex(client => client.NetworkId);
entity.HasIndex(client => client.LastConnection);
entity.HasAlternateKey(client => new entity.HasAlternateKey(client => new
{ {
client.NetworkId, client.NetworkId,

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations.MySql
{
public partial class AddLastConnectionIndexEFClient : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_EFClients_LastConnection",
table: "EFClients",
column: "LastConnection");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_EFClients_LastConnection",
table: "EFClients");
}
}
}

View File

@ -96,6 +96,8 @@ namespace Data.Migrations.MySql
b.HasIndex("CurrentAliasId"); b.HasIndex("CurrentAliasId");
b.HasIndex("LastConnection");
b.HasIndex("NetworkId"); b.HasIndex("NetworkId");
b.ToTable("EFClients", (string)null); b.ToTable("EFClients", (string)null);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations.Postgresql
{
public partial class AddLastConnectionIndexEFClient : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_EFClients_LastConnection",
table: "EFClients",
column: "LastConnection");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_EFClients_LastConnection",
table: "EFClients");
}
}
}

View File

@ -103,6 +103,8 @@ namespace Data.Migrations.Postgresql
b.HasIndex("CurrentAliasId"); b.HasIndex("CurrentAliasId");
b.HasIndex("LastConnection");
b.HasIndex("NetworkId"); b.HasIndex("NetworkId");
b.ToTable("EFClients", (string)null); b.ToTable("EFClients", (string)null);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations.Sqlite
{
public partial class AddLastConnectionIndexEFClient : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_EFClients_LastConnection",
table: "EFClients",
column: "LastConnection");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_EFClients_LastConnection",
table: "EFClients");
}
}
}

View File

@ -94,6 +94,8 @@ namespace Data.Migrations.Sqlite
b.HasIndex("CurrentAliasId"); b.HasIndex("CurrentAliasId");
b.HasIndex("LastConnection");
b.HasIndex("NetworkId"); b.HasIndex("NetworkId");
b.ToTable("EFClients", (string)null); b.ToTable("EFClients", (string)null);