Say that the recorded-size read's cheapness is incidental, and on which axis that differs (#3199 follow-up) - #3215
Merged
Conversation
…ch axis that differs Review finding, verified: every row one SweepAsync run writes carries the same metric_time by design, and idx_store_metrics_time indexes (metric_time) alone - so the backward scan reaches the whole-store row early only because StoreInsertSql happens to run last, not because the query says so. Measured 3 buffers on a 225 GiB store, which is that ordering holding. Accepted rather than fixed here, and the reason is the growth axis rather than the magnitude. The tied group is one sweep's output - TimescaleSupport.HypertableCount (70 today) plus one row per background job plus two dimensions plus this one - so it tracks the collector catalog, a product constant that moves only when a rung adds a hypertable. pg_database_size tracked the store's file count, which retention span and ingest grow without anything choosing to. A composite (object_kind, metric_time DESC) index is the right follow-up. It needs a migration rung, and claiming a rung number alongside unmerged siblings is its own hazard, so it is not bundled into the change that removed the unbounded read.
|
Reviewed. This is a pure XML-doc addition to Spot-checked the factual claims against source, all confirmed:
No issues found. |
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.
Follow-up to #3203 (#3199). Comment-only — twenty added lines of doc comment on
StoreSelfMetrics.LatestStoreSizeSql, no code change.Why it is its own PR
The review bot on #3203 raised a non-blocking finding I agreed with, and I committed the disposition to the branch. #3203 merged at
6f6e2f5bbefore that commit was pushed, so the commit landed on a branch whose PR was already closed — and a closed PR dispatches nopull_requestworkflows, so it sat on the remote with zero check-runs and no path intodev. Cherry-picked onto currentdevhere so it actually gets CI and actually lands.Worth naming because the emptiness reads as a pass: a "no check failed" filter over zero check-runs returns "none failed". The tell is the distinct-name count, which was 0, not 8.
The finding, verified in source
idx_store_metrics_time(V53) indexes(metric_time)alone, and every row oneStoreSelfMetrics.SweepAsyncrun writes carries the samemetric_time— oneutcNowstamps all of them, deliberately, so a run's rows join. SoORDER BY metric_time DESC LIMIT 1 WHERE object_kind = 'store'reaches the whole-store row early only becauseStoreInsertSqlhappens to run last in the sweep, not because the query says so. TheEXPLAIN (ANALYZE, BUFFERS)in #3203 came back at three buffers, which is that ordering holding rather than the query guaranteeing anything. Reordering the sweep, aVACUUMor aREINDEXcould make the scan step past the tied group first.One correction to the magnitude, in the direction that supports the finding: the tied group is larger than the
~30 rows/hourfigure that file's own retention note quotes, which predates the background-job rows.TimescaleSupport.HypertableCountis 70 today (read off the shipped constant, not counted by eye), plus one row per Timescale background job, plus two dimension rows, plus this one.Why it is documented rather than fixed
The growth axis, not the magnitude.
pg_database_sizetracked the store's file count, which retention span and ingest rate grow without anything choosing to — that is what turned an 806x margin into 1.57x with no code change and nothing noticing, which is #3199. The tied group tracks the collector catalog, which moves only when a migration rung adds a hypertable: a product constant, changed deliberately, in a commit someone reviews. Both are "cheap today"; only one gets more expensive while nobody is looking.A composite
(object_kind, metric_time DESC)index would make it exact and is the right follow-up. It needs a migration rung, and claiming a rung number alongside unmerged sibling branches is its own hazard here — a collision is loud, a gap is silent and unrepairable — so it does not belong bundled into either this note or the change that removed the unbounded read.What this PR buys is that an incidental property is written down as incidental. The query previously read as though the index guaranteed its own cheapness.
Verification
Comment-only, so the guard that matters is doc hygiene:
DocCommentHygieneTests' cref and summary-block rules, 28 tests, 0 failed, run against the real shipped file through anet10.0xunit.v3 harness (the suite targetsnet10.0-windowsand cannot run on macOS).#3199's own pins re-run clean on this branch too — 54 tests, 0 failed, 0 not run.PerformanceMonitor.Darling.StorageandDarling.Testsboth compile with-p:EnableWindowsTargeting=true.No mutation table: there is no behaviour to mutate. The added
<para>blocks are prose, and the two things about them that can be mechanically wrong — an unresolvablecrefand a stacked<summary>— are what those 28 tests check. The nested-<para>typo the first draft had was caught by exactly that route.CHANGELOG
Not edited, per the standing rule. This is a comment on a change already described by #3199's entry, so it needs no entry of its own — the reasoning belongs in the code, which is where it now is.