Skip to content

Conversation

@dbaseqp
Copy link
Owner

@dbaseqp dbaseqp commented Jan 26, 2026

No description provided.

Copilot AI review requested due to automatic review settings January 26, 2026 07:42
Copy link

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 introduces a PostgreSQL materialized view to precompute cumulative team scores per round, reducing query cost for score graph endpoints.

Changes:

  • Add cumulative_scores materialized view + unique index during DB connect.
  • Switch cumulative score-by-round query to read from the materialized view instead of running a window function per request.
  • Refresh the materialized view after each round (asynchronously) and after score resets.

Reviewed changes

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

Show a summary per file
File Description
engine/engine.go Triggers an async refresh of the cumulative scores materialized view after processing each round.
engine/db/servicechecks.go Reads cumulative scores from cumulative_scores instead of computing via a window function on each call.
engine/db/rounds.go Adds RefreshScoresMaterializedView() helper with concurrent refresh when possible.
engine/db/db.go Creates the cumulative_scores materialized view and index at startup; refreshes it during ResetScores().
IMPLEMENTATION_SUMMARY.md Documents the materialized view approach, refresh strategy, and rationale.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tire-fire
Copy link
Contributor

Looks good to me

@dbaseqp dbaseqp merged commit 2b7c7f7 into main Jan 30, 2026
8 checks passed
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