Repository navigation
Conversation
The filters applied to the visits only; the record sums, the unpriced
models and the billing mode were each built over every station run's
records first. A summary for one run took seconds, and so did
GET /assembly-runs/{id}, which asks for it.
The visits are picked first, and the records are read for those alone,
by their primary key. On 30,000 visits and 600,000 records one run went
from 321 ms to 3 ms.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Lore is reviewing this PR — 7351e5b1-9ed2-4c9f-9220-8945c7c0f1dc. Submit a review that requests changes to have Lore push a fix for it. Comment |
There was a problem hiding this comment.
Lore review — Approved
Scopes CostsStore.summary record CTEs to the filtered station runs so per-run and filtered cost queries read only matching visits' records by primary key.
Must fix (0) · Consider (0) · Nits (0)
Reviewed by gemini-4-argon
Submit a review that requests changes to have Lore push a fix for it. Comment @lore review to re-run the review.
Posted by floor, visit 261c5e22-91a8-4615-9682-ad54310ccae1.
Contributor
Author
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 #52.
A cost summary built its record sums, its unpriced models and its billing mode over every station run's records, and only then joined them to the visits the filter had picked. So a summary for one run took as long as one for the whole database, and
GET /assembly-runs/{id}, which asks for the cost of its run, took seconds with it.The visits are now picked first, and the records are read for those alone, by the records' primary key. The figures and the response are unchanged.
/metricsstill sums every record, as it should.On a scratch database of 30,000 visits and 600,000 records, through the real store: one run went from 321 ms to 3 ms, and a 30-minute span from 589 ms to 16 ms. The old time grows with the table and the new one does not, so the production figures in the issue should fall by the same factor; worth repeating the three requests there after the deploy.
A new store test pins that a run's summary names only its own unpriced model. The existing cost tests pass untouched. The
grouplists in the API README and in the storage doc were stale (norun, nobilling_mode) and are corrected.🤖 Generated with Claude Code