Skip to content

Optimize portable update_points DB path#48

Closed
mateu wants to merge 1 commit into
masterfrom
koan/update-points-set-based-portable-sql
Closed

Optimize portable update_points DB path#48
mateu wants to merge 1 commit into
masterfrom
koan/update-points-set-based-portable-sql

Conversation

@mateu
Copy link
Copy Markdown
Owner

@mateu mateu commented Apr 5, 2026

What: Replace the portable (non-MySQL) update_points score rebuild loops with set-based SQL updates for region_score and player totals.

Why: /update_points spent most of its portable runtime in per-row DBIC loops (update_or_create + per-player updates), which does not scale with player count.

How: Keep the existing winner/lower-seed and round-out logic, then rebuild region_score in one INSERT ... SELECT over player x region with a left-joined aggregate of correct picks; recompute player.points in one SQL UPDATE from region_score sums.

Testing: script/test-env.sh prove -lv t/model_update_points.t and script/test-env.sh prove -lr t.


Quality Report

Changes: 2 files changed, 62 insertions(+), 34 deletions(-)

Code scan: clean

Tests: skipped

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

@mateu mateu closed this Apr 7, 2026
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