Skip to content

fix(webserver): replace full hypertable COUNT with precomputed cml_stats sum#49

Merged
cchwala merged 3 commits into
mainfrom
fix/webserver-count-perf
May 18, 2026
Merged

fix(webserver): replace full hypertable COUNT with precomputed cml_stats sum#49
cchwala merged 3 commits into
mainfrom
fix/webserver-count-perf

Conversation

@cchwala
Copy link
Copy Markdown
Member

@cchwala cchwala commented May 18, 2026

The overview page called SELECT COUNT(*) FROM cml_data_secure, which triggered a full sequential scan and chunk decompression across the entire compressed TimescaleDB hypertable on every page load, pinning Postgres workers for ~1 minute.

Replace with SELECT COALESCE(SUM(total_records), 0) FROM cml_stats, which reads the pre-aggregated per-CML summary table already maintained by update_cml_stats(). No schema change required.

…ats sum

SELECT COUNT(*) FROM cml_data_secure caused a full sequential scan and
chunk decompression on every login, pinning Postgres workers for ~1 min.
Replace with SUM(total_records) FROM cml_stats which reads the already-
computed per-CML summary table instead.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.42%. Comparing base (d5cee5d) to head (53d102d).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #49      +/-   ##
==========================================
+ Coverage   82.63%   84.42%   +1.78%     
==========================================
  Files          28       24       -4     
  Lines        2920     2555     -365     
==========================================
- Hits         2413     2157     -256     
+ Misses        507      398     -109     
Flag Coverage Δ
mno_simulator 86.12% <ø> (ø)
parser 88.88% <ø> (ø)
scripts ?
webserver 70.78% <100.00%> (+2.99%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cchwala cchwala merged commit ae79bfe into main May 18, 2026
7 checks passed
@cchwala cchwala deleted the fix/webserver-count-perf branch May 18, 2026 20:29
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