perf(ch): serve latest-state and summary queries from precomputed tables#298
Merged
Conversation
Pinned to the feat/signal-latest-table branch head (pre-v1.0.13 pseudo-version); re-pin to the v1.0.13 tag once released.
signalsLatest/signalsSnapshot/lastSeen/availableSignals now read the precomputed signal_latest table (model-garage 00010) instead of fanning out across every part of the raw signal table. Location fields read kind=1 rows, which pre-filter (0,0) fixes, so plain argMax replaces argMaxIf. Supersedes the projection-matching shapes from #284/#297. dataSummary per-name count/first-seen/last-seen now read the AggregatingMergeTree summary tables (model-garage 00011) instead of aggregating the raw tables. Counts are over raw inserts, matching the approximation of the previous non-FINAL count(*) reads.
…istency Scanning is positional so agg_location worked, but the non-location branch of the latest UNION ALL aliases its zero tuple value_location; matching aliases keep the result shape self-describing.
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.
Summary
signal_latesttable (ReplacingMergeTree, model-garage 00010) instead of fanning out across every part of the ~97B-rowsignaltable.signal_summary/event_summary(AggregatingMergeTree, model-garage 00011).TestLatestQueriesUseProjection(asserted the projections being dropped in model-garage 00012).Evidence (prod, 2026-06-11)
Projections are stored per part, so latest-state reads inherit the ~140-part fan-out: signalsLatest via projection p50 = 2995ms (31,467 queries/day) vs raw primary-key reads p50 = 110ms. Point lookups on signal_latest target single-digit ms.
Rollout (order matters)
Test plan