perf(db): implement composite B-Tree database indexes for filtering and pagination (#105) - #138
Merged
Merged
Conversation
- Add composite index IX_Incidents_CreatedAt_Status_Category on (CreatedAt DESC, Status, Category) - Add composite index IX_Teams_Status_TeamName on (Status, TeamName) - Add composite index IX_Users_RoleType_Department_FirstName_LastName on (RoleType, Department, FirstName, LastName) - Generate and apply PostgreSQL migration AddCompositeIndexesForFilteringAndPagination - Add unit tests verifying EF Core model metadata and descending sort configuration - Verify EXPLAIN ANALYZE execution plans switch from Seq Scan to Index Scan Closes #105 Ref: SDDC-69
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Jira / Task Reference
database📝 Summary of Changes
Implements composite B-Tree database indexes across the
Incidents,Teams, andUserstables in accordance with NFR-01, NFR-02, and Section 4.2 of the Design Document:(CreatedAt DESC, Status, Category)(IX_Incidents_CreatedAt_Status_Category) to optimize chronological incident queue pagination and multi-parameter status/category filtering.(Status, TeamName)(IX_Teams_Status_TeamName) for fast idle team lookup and name prefix searching.(RoleType, Department, FirstName, LastName)(IX_Users_RoleType_Department_FirstName_LastName) to optimize directory filtering by organizational unit and role-based searching.20260831152146_AddCompositeIndexesForFilteringAndPagination.cs.DbContextConstraintTests.csvalidating index names, property sequences, and descending ordering.🏷️ Type of Change
🧪 Testing & Verification
Automated Tests
dotnet test(118/118 passed)dotnet format --verify-no-changesManual Test Steps & PostgreSQL Execution Plans
dotnet ef database update.pg_indexes.EXPLAIN (ANALYZE, BUFFERS)verifying switch fromSeq ScantoIndex Scan:Incidentsstatus/category query:Index Scan using "IX_Incidents_CreatedAt_Status_Category"(~1.26ms)Teamsavailability query:Index Scan using "IX_Teams_Status_TeamName"(~1.19ms)Usersrole & department query:Index Scan using "IX_Users_RoleType_Department_FirstName_LastName"(~1.34ms)📷 Screenshots / Evidence (Required for UI / API changes)
Index Scan using "IX_Incidents_CreatedAt_Status_Category" on "Incidents"Index Scan using "IX_Teams_Status_TeamName" on "Teams"Index Scan using "IX_Users_RoleType_Department_FirstName_LastName" on "Users"📋 Pre-Merge Checklist
.envexclusions).In Review.