Skip to content

Improve performance#51

Merged
arktronic-sep merged 2 commits into
sep:mainfrom
arktronic:speedup
Apr 4, 2026
Merged

Improve performance#51
arktronic-sep merged 2 commits into
sep:mainfrom
arktronic:speedup

Conversation

@arktronic
Copy link
Copy Markdown
Contributor

Also update dependencies and fix a small bug

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR focuses on improving query performance in the Web layer by reducing heavy includes / repeated subqueries, adding a covering index for CheckResults, and updating related dependencies and tests.

Changes:

  • Refactor workspace and check list queries to compute “latest status” data more efficiently and leverage no-tracking reads.
  • Replace loading full alert history collections with a direct COUNT(*) query for alert history counts.
  • Add a Postgres covering index on (CheckId, CheckedAt DESC) including commonly-read columns, and bump EF/Npgsql package versions.

Reviewed changes

Copilot reviewed 34 out of 35 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
SAMA.Web/Services/Queries/WorkspaceQueryService.cs Refactors workspace list/details status counts into a separate query + in-memory aggregation.
SAMA.Web/Services/Queries/CheckQueryService.cs Refactors workspace check list to fetch latest results via a second query instead of including full histories.
SAMA.Web/Services/Queries/AlertQueryService.cs Avoids loading AlertHistories by counting histories via a separate query.
SAMA.Web/SAMA.Web.csproj Updates ASP.NET / EF-related package versions.
SAMA.Web/Pages/Shared/WorkspacePageModel.cs Updates WorkspaceQueryService construction to include ApplicationStateService.
SAMA.Tests.Unit/Web/Pages/Workspaces/IndexModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/Workspaces/EditModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/Workspaces/DeleteModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/NotificationChannels/IndexModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/NotificationChannels/EditModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/NotificationChannels/DetailsModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/NotificationChannels/DeleteModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/NotificationChannels/CreateModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/EventSubscriptions/ManageModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/EventSubscriptions/IndexModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/Dashboard/IndexModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/Checks/IndexModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/Checks/EditModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/Checks/DetailsModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/Checks/DeleteModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/Checks/CreateModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/Alerts/IndexModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/Alerts/EditModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/Alerts/DetailsModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/Alerts/DeleteModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/Alerts/CreateModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Unit/Web/Pages/Admin/Settings/IndexModelTests.cs Updates WorkspaceQueryService substitute construction for new constructor signature.
SAMA.Tests.Integration/Web/Services/Queries/WorkspaceQueryServiceTests.cs Adds integration coverage for status counting logic and pending-state rules.
SAMA.Tests.Integration/SAMA.Tests.Integration.csproj Bumps EF / DI / Npgsql package versions for integration tests.
SAMA.Shared/SAMA.Shared.csproj Bumps Microsoft.Extensions.Http package version.
SAMA.Data/SAMA.Data.csproj Bumps EF / Identity EF / Npgsql package versions.
SAMA.Data/Migrations/SamaDbContextModelSnapshot.cs Updates EF model snapshot and index metadata for the new covering index.
SAMA.Data/Migrations/20260403004123_AddCoveringIndexForCheckResults.Designer.cs Adds migration designer for the covering index change.
SAMA.Data/Migrations/20260403004123_AddCoveringIndexForCheckResults.cs Adds migration to replace the prior index with a covering index.
SAMA.Data/Configuration/CheckResultConfiguration.cs Updates EF configuration to define the covering index with included properties.
Files not reviewed (1)
  • SAMA.Data/Migrations/20260403004123_AddCoveringIndexForCheckResults.Designer.cs: Language not supported

Comment thread SAMA.Web/Services/Queries/WorkspaceQueryService.cs
Comment thread SAMA.Web/Services/Queries/WorkspaceQueryService.cs Outdated
Comment thread SAMA.Web/Services/Queries/WorkspaceQueryService.cs
Comment thread SAMA.Web/Services/Queries/WorkspaceQueryService.cs Outdated
Comment thread SAMA.Web/Services/Queries/CheckQueryService.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 34 out of 35 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • SAMA.Data/Migrations/20260403004123_AddCoveringIndexForCheckResults.Designer.cs: Language not supported

@arktronic-sep arktronic-sep merged commit 356846c into sep:main Apr 4, 2026
8 checks passed
@arktronic arktronic deleted the speedup branch April 4, 2026 19:06
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.

3 participants