Repository navigation
fix: sum rollups in Postgres instead of in the application - #361
Merged
Merged
Conversation
The cost panel, the leaderboards, the daily trend and the KPIs fetched one daily_test_stats row per test per day and added them up in JavaScript, so their cost grew with suite size times days: 600,000 rows for 20,000 tests over a month. Each now asks Postgres for exactly what it shows: sums per day, the top rows of each leaderboard, and for cost only the tests with reruns or flaky occurrences, ranked in the application as before. The quarantine figures start from the quarantined identities rather than joining every row. Ties in the rankings break on test id instead of on whatever order the rows arrived in. p95 at 20,000 tests: cost 2,433 -> 104 ms, leaderboards 1,301 -> 146 ms, daily trend 586 -> 61 ms, KPIs 373 -> 74 ms. At 2,000 tests the cost panel went from 186 to 8 ms. Closes #358
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.
Closes #358
getFlakinessCost,getTestLeaderboards,getDailyTrendandgetProjectHealthKpisloaded every per-test daily rollup row in their window and summed them in JavaScript. Each now asks Postgres for what it shows:limitrows of each board, joined to their identitiesNumbers
packages/queries/bench(ADR-0005), p95 ms:All four are under the 300 ms target at 20,000 tests.
Same answers
rollup-aggregates-db.test.tsseeds 120 tests over 20 days with random counts, some quarantined, plus a noisy row in another project. It compares each function with a reference that adds the raw rows up the old way.The first version of that test failed intermittently on cost offenders. Two tests tied on both spend and rerun time, and the reference kept them in insertion order while the query returned them by id. The old code had the same problem: ties came out in whatever order the rows arrived. Rankings now break ties on test id, explicitly in both. Eight consecutive runs pass, and the existing cost tests, the full queries suite (293) and the web suite pass.