Skip to content

Improve index performance on Entity Framework persisters - #5881

Open
rbev wants to merge 4 commits into
masterfrom
missing-indexes
Open

Improve index performance on Entity Framework persisters#5881
rbev wants to merge 4 commits into
masterfrom
missing-indexes

Conversation

@rbev

@rbev rbev commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces new and optimized database indexes to both the SQL Server and PostgreSQL EF Core persistence layers, aiming to improve the performance of queries on failed messages and failure groups. The changes include adding covering indexes (with INCLUDE columns) for key aggregate queries, introducing new indexes to support sorting and filtering in the UI, and enforcing indexable column lengths for message types. These enhancements are reflected in both the migration files and the EF Core model configuration.

Database Indexing Improvements

  • Added covering indexes (with INCLUDE columns) to the Status, LastModified index on FailedMessages and the Type, GroupId index on FailedMessageGroups in both SQL Server and PostgreSQL providers, improving index-only scan performance for group aggregate queries. [1] [2] [3] [4] [5] [6] [7] [8]

  • Added new indexes to FailedMessages for (Status, LastTimeOfFailure) and (Status, MessageType, UniqueMessageId) to support efficient sorting and filtering in the failed messages UI. [1] [2] [3] [4] [5] [6] [7]

Schema and Model Changes

  • Updated the MessageType column on FailedMessages to have a maximum length of 450 characters (from unlimited text) to allow indexing and prevent issues on SQL Server and PostgreSQL. [1] [2] [3] [4] [5]

Documentation and Comments

  • Added detailed comments to the entity configurations explaining the purpose and provider-specific nature of the new and widened indexes, as well as rationale for column length restrictions. [1] [2] [3] [4] [5]

Query Logic Update

  • Updated the group retrieval logic in GroupsDataStore to use the new optimized method for fetching unresolved groups, aligning with the new index structures.

These changes collectively improve query performance for key recoverability and failed message scenarios, and ensure the schema is optimized for both SQL Server and PostgreSQL backends.

@rbev rbev changed the title Widen failure group indexes Improve index performance on Entity Framework persisters Sep 11, 2026
@rbev
rbev marked this pull request as ready for review September 11, 2026 04:15
@rbev
rbev enabled auto-merge September 11, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant