Repository navigation
Add time-series codecs to auto-created TimeSeries samples columns - #112110
Conversation
Under generic LZ4 the near-monotonic millisecond timestamps of a scrape-like corpus barely compress (ratio ~0.65) and dominate the samples table: 76.3 of 83.1 GiB (92%) on a 15.7B-sample benchmark corpus, where decompression+deserialization was ~45% of query CPU. Auto-created `timestamp` and `value` columns now default to CODEC(DoubleDelta, ZSTD(1)) and CODEC(Gorilla, ZSTD(1)) respectively. All types accepted by the type validation are compatible with these codecs; explicitly declared columns keep the user's choice. Co-Authored-By: Claude Fable 5 <[email protected]> (cherry picked from commit ec97042)
|
Workflow [PR], commit [f9eb85a] Summary: ❌
AI ReviewSummaryThis PR makes auto-created Findings
Final Verdict
|
The auto-created `timestamp` and `value` samples columns now carry `CODEC(DoubleDelta, ZSTD(1))` and `CODEC(Gorilla, ZSTD(1))`, so the `extract` pattern `\(([^)]*)\)` truncated the `SAMPLES INNER COLUMNS` block at the first closing parenthesis inside the codec. Anchor the extraction at `) SAMPLES INNER ENGINE` instead and update the reference. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=111697&sha=ec9704295fe958b3049ff9e841cf248d8a907345&name_0=PR&name_1=Fast%20test PR: #111697 Co-Authored-By: Claude Fable 5 <[email protected]>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
|
📊 Cloud Performance Report ✅ AI verdict: This PR only changes normalization of the experimental TimeSeries table engine (auto-adding DoubleDelta/Gorilla codecs to engine-created columns), plus its docs and tests. None of that touches the query-execution path ClickBench Q4 runs, so it cannot plausibly cause a real speedup. The flagged -19.9% on Q4 shows essentially unchanged CPU (2700.9 vs 2703.9 ms), confirming it is run-to-run variance within master's current band; the deterministic no_change verdict is correct and consistent with the diff. clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
| /// (>90% of on-disk bytes on a scrape-like corpus). All types accepted by the validation | ||
| /// above are compatible: DoubleDelta takes DateTime64/DateTime/UInt32, Gorilla takes | ||
| /// Float64/Float32. Explicitly declared columns keep whatever the user wrote. | ||
| auto set_codec_for_new_column = [&](const char * codec_name) |
There was a problem hiding this comment.
This helper function doesn't really look good. Probably better to make add_column_if_missing return ASTColumnDeclaration * instead of bool and use it then to add codec to declaration.
Address review comment: instead of a bool and a helper reaching into new_list->children.back(), return the newly created declaration (nullptr if the column already existed) and set the codec on it directly. Also simplifies the ephemeral all_tags column setup the same way. #112110 (comment) Co-Authored-By: Claude Fable 5 <[email protected]>
36cd3b6 to
f9eb85a
Compare
| | `timestamp` | [x] | `DateTime64(3)` | `DateTime64(X)` | A time point | | ||
| | `value` | [x] | `Float64` | `Float32` or `Float64` | A value associated with the `timestamp` | | ||
|
|
||
| Columns the engine creates itself get time-series compression codecs: |
There was a problem hiding this comment.
The Possible types cell above is still incomplete for the new codec-default contract. normalizeTimeSeriesDefinition accepts DateTime and UInt32 for timestamp too, and 04600_timeseries_column_validation exercises the UInt32 case, so this table now contradicts both the implementation and the time_series Array(Tuple(UInt32, Float32)) example earlier on the page. Please expand the documented timestamp type set here and in the mirrored docs/en page to match the actual validation rules.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 70/70 (100.00%) · Uncovered code |
|
@groeneai help investigate test failures. As usual, link existing PRs or fix yourself. |
|
Not caused by this PR. The one red check is Decomposition. All 5 failures are in Root cause, from the TSan report in the job artifacts. The context of
Line 537 is the This is worse than a sanitizer-only report. The container is Why it is not yours. The PR changes 7 files ( Owner. No fixing PR exists yet. #110886 is the only open PR reworking this area, and it does not fix this: it moves Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=112110&sha=f9eb85aa73767a4395f350ced48717ec7fbfd121&name_0=PR&name_1=Integration%20tests%20%28amd_tsan%2C%201%2F6%29 |
The samples inner table of a newly created TimeSeries table now also has the `locality_hash` column, so the test added on master in #112110 lists one more column. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Fixing PR for the Root cause: #109339 added a Timeline: #109339 merged 2026-07-28 13:16 UTC, the master cascade began the same evening, #112381 reverted it 2026-07-29 01:39 UTC. Every failing build contained the introducing commit and lacked the revert. True-master runs since the revert are clean: 0 failures against 6804 passing rows across 23 distinct commits. #112382 re-lands the feature with No action is needed on this PR: its diff never touched PostgreSQL replication and did not cause this line. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Auto-created
timestampandvaluecolumns of the TimeSeries samples inner table now default toCODEC(DoubleDelta, ZSTD(1))andCODEC(Gorilla, ZSTD(1))respectively.Documentation entry for user-facing changes
Extracted from #111697 (rebased onto master so it can be reviewed independently). Companion PR: #112108 (parallelize the Prometheus query API).
Under generic LZ4, the near-monotonic millisecond timestamps of a scrape-like workload barely compress (ratio ~0.65) and dominate the samples inner table. On a ~15.7B-sample kube-mixin corpus (tsbench, scale 16) the
timestampcolumn was 76.3 of 83.1 GiB — 92% of the table — and decompression+deserialization was ~45% of PromQL query CPU. DoubleDelta for timestamps and Gorilla (XOR) for float values are the standard encodings for this kind of data (the same family Prometheus uses natively).Scope and compatibility:
04648_timeseries_samples_codecstest).Measured on the corpus above (debug build): samples storage 82.8 GiB → 30.6 GiB (5.68 → 2.09 bytes/sample); ingest of 15.7B samples unchanged within noise (1095 s → 1037 s); identical results on all 24 benchmark queries.
🤖 Generated with Claude Code
Version info
26.8.1.315(included in26.8and later)