diff --git a/src/ParcelRegistry.Projections.Integration/Migrations/20240731070709_AddVersionParcelIdIndex.Designer.cs b/src/ParcelRegistry.Projections.Integration/Migrations/20240731070709_AddVersionParcelIdIndex.Designer.cs
new file mode 100644
index 00000000..17a5f40e
--- /dev/null
+++ b/src/ParcelRegistry.Projections.Integration/Migrations/20240731070709_AddVersionParcelIdIndex.Designer.cs
@@ -0,0 +1,281 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using NetTopologySuite.Geometries;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+using ParcelRegistry.Projections.Integration;
+
+#nullable disable
+
+namespace ParcelRegistry.Projections.Integration.Migrations
+{
+ [DbContext(typeof(IntegrationContext))]
+ [Migration("20240731070709_AddVersionParcelIdIndex")]
+ partial class AddVersionParcelIdIndex
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.3")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "postgis");
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner.ProjectionStates.ProjectionStateItem", b =>
+ {
+ b.Property("Name")
+ .HasColumnType("text");
+
+ b.Property("DesiredState")
+ .HasColumnType("text");
+
+ b.Property("DesiredStateChangedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ErrorMessage")
+ .HasColumnType("text");
+
+ b.Property("Position")
+ .HasColumnType("bigint");
+
+ b.HasKey("Name");
+
+ b.ToTable("ProjectionStates", "integration_parcel");
+ });
+
+ modelBuilder.Entity("ParcelRegistry.Projections.Integration.ParcelLatestItem.ParcelLatestItem", b =>
+ {
+ b.Property("ParcelId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasColumnName("parcel_id");
+
+ b.Property("CaPaKey")
+ .IsRequired()
+ .HasMaxLength(20)
+ .HasColumnType("varchar")
+ .HasColumnName("capakey");
+
+ b.Property("Geometry")
+ .IsRequired()
+ .HasColumnType("geometry")
+ .HasColumnName("geometry");
+
+ b.Property("IsRemoved")
+ .HasColumnType("boolean")
+ .HasColumnName("is_removed");
+
+ b.Property("Namespace")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("namespace");
+
+ b.Property("OsloStatus")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("oslo_status");
+
+ b.Property("Puri")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("puri");
+
+ b.Property("Status")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("status");
+
+ b.Property("VersionAsString")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("version_as_string");
+
+ b.Property("VersionTimestampAsDateTimeOffset")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("version_timestamp");
+
+ b.HasKey("ParcelId");
+
+ b.HasIndex("CaPaKey");
+
+ b.HasIndex("Geometry");
+
+ NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("Geometry"), "GIST");
+
+ b.HasIndex("IsRemoved");
+
+ b.HasIndex("OsloStatus");
+
+ b.HasIndex("Status");
+
+ b.HasIndex("IsRemoved", "Status");
+
+ b.ToTable("parcel_latest_items", "integration_parcel");
+ });
+
+ modelBuilder.Entity("ParcelRegistry.Projections.Integration.ParcelLatestItem.ParcelLatestItemAddress", b =>
+ {
+ b.Property("ParcelId")
+ .HasColumnType("uuid")
+ .HasColumnName("parcel_id");
+
+ b.Property("AddressPersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("address_persistent_local_id");
+
+ b.Property("CaPaKey")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("capakey");
+
+ b.Property("Count")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasDefaultValue(1);
+
+ b.HasKey("ParcelId", "AddressPersistentLocalId");
+
+ b.HasIndex("AddressPersistentLocalId");
+
+ b.HasIndex("CaPaKey");
+
+ b.HasIndex("ParcelId");
+
+ b.ToTable("parcel_latest_item_addresses", "integration_parcel");
+ });
+
+ modelBuilder.Entity("ParcelRegistry.Projections.Integration.ParcelVersion.ParcelVersion", b =>
+ {
+ b.Property("Position")
+ .HasColumnType("bigint")
+ .HasColumnName("position");
+
+ b.Property("ParcelId")
+ .HasColumnType("uuid")
+ .HasColumnName("parcel_id");
+
+ b.Property("CaPaKey")
+ .IsRequired()
+ .HasMaxLength(20)
+ .HasColumnType("varchar")
+ .HasColumnName("capakey");
+
+ b.Property("CreatedOnAsString")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("created_on_as_string");
+
+ b.Property("CreatedOnTimestampAsDateTimeOffset")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("created_on_timestamp");
+
+ b.Property("Geometry")
+ .HasColumnType("geometry")
+ .HasColumnName("geometry");
+
+ b.Property("IsRemoved")
+ .HasColumnType("boolean")
+ .HasColumnName("is_removed");
+
+ b.Property("Namespace")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("namespace");
+
+ b.Property("OsloStatus")
+ .HasColumnType("text")
+ .HasColumnName("oslo_status");
+
+ b.Property("Puri")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("puri");
+
+ b.Property("Status")
+ .HasColumnType("text")
+ .HasColumnName("status");
+
+ b.Property("Type")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("type");
+
+ b.Property("VersionAsString")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("version_as_string");
+
+ b.Property("VersionTimestampAsDateTimeOffset")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("version_timestamp");
+
+ b.HasKey("Position", "ParcelId");
+
+ b.HasIndex("CaPaKey");
+
+ b.HasIndex("Geometry");
+
+ NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("Geometry"), "GIST");
+
+ b.HasIndex("IsRemoved");
+
+ b.HasIndex("OsloStatus");
+
+ b.HasIndex("ParcelId");
+
+ b.HasIndex("Status");
+
+ b.HasIndex("Type");
+
+ b.HasIndex("VersionTimestampAsDateTimeOffset");
+
+ b.ToTable("parcel_version", "integration_parcel");
+ });
+
+ modelBuilder.Entity("ParcelRegistry.Projections.Integration.ParcelVersion.ParcelVersionAddress", b =>
+ {
+ b.Property("Position")
+ .HasColumnType("bigint")
+ .HasColumnName("position");
+
+ b.Property("ParcelId")
+ .HasColumnType("uuid")
+ .HasColumnName("parcel_id");
+
+ b.Property("AddressPersistentLocalId")
+ .HasColumnType("integer")
+ .HasColumnName("address_persistent_local_id");
+
+ b.Property("CaPaKey")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("capakey");
+
+ b.Property("Count")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasDefaultValue(1)
+ .HasColumnName("count");
+
+ b.HasKey("Position", "ParcelId", "AddressPersistentLocalId");
+
+ b.HasIndex("AddressPersistentLocalId");
+
+ b.HasIndex("CaPaKey");
+
+ b.HasIndex("ParcelId");
+
+ b.HasIndex("Position");
+
+ b.ToTable("parcel_version_addresses", "integration_parcel");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/src/ParcelRegistry.Projections.Integration/Migrations/20240731070709_AddVersionParcelIdIndex.cs b/src/ParcelRegistry.Projections.Integration/Migrations/20240731070709_AddVersionParcelIdIndex.cs
new file mode 100644
index 00000000..c86feebe
--- /dev/null
+++ b/src/ParcelRegistry.Projections.Integration/Migrations/20240731070709_AddVersionParcelIdIndex.cs
@@ -0,0 +1,29 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace ParcelRegistry.Projections.Integration.Migrations
+{
+ ///
+ public partial class AddVersionParcelIdIndex : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateIndex(
+ name: "IX_parcel_version_parcel_id",
+ schema: "integration_parcel",
+ table: "parcel_version",
+ column: "parcel_id");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropIndex(
+ name: "IX_parcel_version_parcel_id",
+ schema: "integration_parcel",
+ table: "parcel_version");
+ }
+ }
+}
diff --git a/src/ParcelRegistry.Projections.Integration/Migrations/IntegrationContextModelSnapshot.cs b/src/ParcelRegistry.Projections.Integration/Migrations/IntegrationContextModelSnapshot.cs
index c6dd956e..24fad81d 100644
--- a/src/ParcelRegistry.Projections.Integration/Migrations/IntegrationContextModelSnapshot.cs
+++ b/src/ParcelRegistry.Projections.Integration/Migrations/IntegrationContextModelSnapshot.cs
@@ -224,6 +224,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.HasIndex("OsloStatus");
+ b.HasIndex("ParcelId");
+
b.HasIndex("Status");
b.HasIndex("Type");
diff --git a/src/ParcelRegistry.Projections.Integration/ParcelVersion/ParcelVersion.cs b/src/ParcelRegistry.Projections.Integration/ParcelVersion/ParcelVersion.cs
index 396f86d0..7e444b12 100644
--- a/src/ParcelRegistry.Projections.Integration/ParcelVersion/ParcelVersion.cs
+++ b/src/ParcelRegistry.Projections.Integration/ParcelVersion/ParcelVersion.cs
@@ -148,7 +148,7 @@ public void Configure(EntityTypeBuilder builder)
builder.Ignore(parcel => parcel.VersionTimestamp);
builder.Ignore(parcel => parcel.CreatedOnTimestamp);
-
+ builder.HasIndex(parcel => parcel.ParcelId);
builder.HasIndex(parcel => parcel.CaPaKey);
builder.HasIndex(parcel => parcel.Status);
builder.HasIndex(parcel => parcel.OsloStatus);