Repository navigation
Use Delta, T64, and ALP for TimeSeries sample tables - #120454
Conversation
Apply `ALP` before `ZSTD(3)` to generated main sample values and enable it in the internal creation context. Keep recent samples on `ZSTD(3)`, which compresses their shorter partitions better in the measured dataset. Update normalized definitions and document the defaults. Check `Float32` and `Float64` bit patterns with `enable_alp_codec=0`.
|
Workflow [PR], commit [30eb03a] Summary: ❌
AI ReviewSummaryThis PR switches auto-generated Missing context / blind spots
Findings❌ Blockers
Tests
Final VerdictChanges requested. The LLVM Coverage ReportMeasured on commit 30eb03a.
Changed lines: Changed C/C++ lines covered: 143/145 (98.62%) · Uncovered code |
| auto create_context = Context::createCopy(context); | ||
| /// The default samples codec uses `ALP` independently of the query setting. | ||
| if (inner_table_kind == ViewTarget::Samples) | ||
| create_context->setSetting("enable_alp_codec", true); |
There was a problem hiding this comment.
create_context->setSetting("enable_alp_codec", true) lifts the ALP gate for the whole inner samples CREATE, not just for the engine-generated default value codec. A query like CREATE TABLE t ENGINE = TimeSeries SAMPLES INNER COLUMNS (value Float64 CODEC(ALP(RD))) now succeeds even when the user session keeps enable_alp_codec = 0, because the first codec validation happens inside this internal InterpreterCreateQuery. If the goal is only to allow the synthesized default, the bypass needs to be scoped to that generated column instead of turning ALP on for the entire inner-table definition.
There was a problem hiding this comment.
That's kinda Ok. The TimeSeries has "private preview" tier and ALP is "Beta. Nice to fix for the sake of completeness.
There was a problem hiding this comment.
I agree with Nikita. I also plan to deprecate the setting soon, so long-term it doesn't matter
| if (!codec || is_version_0) | ||
| return true; | ||
| auto codec_name = codec->formatWithSecretsOneLine(); | ||
| return (codec_name == "CODEC(ZSTD(3))") |
There was a problem hiding this comment.
This now classifies SAMPLES INNER COLUMNS (... value Float64 CODEC(ZSTD(3))) as "generated". In the CREATE TABLE copy AS src ENGINE = TimeSeries path, removeGeneratedInnerColumns will drop a source column that the user explicitly declared with plain ZSTD(3), and normalizeInnerColumns later recreates it as CODEC(ALP, ZSTD(3)). That breaks the PR's promise that explicit column declarations keep their codecs. We need some way to distinguish the historical default from an explicit user choice before treating plain ZSTD(3) as auto-generated here.
There was a problem hiding this comment.
Also Ok. We unfold the TimeSeries inner table create statements and store them this way.
| { | ||
| auto zstd = makeASTFunction("ZSTD", make_intrusive<ASTLiteral>(UInt64{3})); | ||
| if (inner_table_kind == ViewTarget::Samples) | ||
| value_decl->setCodec(makeASTFunction("CODEC", make_intrusive<ASTIdentifier>("ALP"), zstd)); |
There was a problem hiding this comment.
This applies CODEC(ALP, ZSTD(3)) for every TimeSeries version, including explicitly pinned old versions. The updated EarlierVersionDoesNotRecordIdType expectation now shows version = 1 generating ALP, even though that path is supposed to preserve an older definition that another server can still read. If the default codec changes without a version guard, SETTINGS version = 1 no longer reproduces the historical samples-table definition. This needs to stay CODEC(ZSTD(3)) for older TimeSeries versions, or the codec change needs a new version with version-aware generation.
There was a problem hiding this comment.
Codecs have interoperability.
| auto create_context = Context::createCopy(context); | ||
| /// The default samples codec uses `ALP` independently of the query setting. | ||
| if (inner_table_kind == ViewTarget::Samples) | ||
| create_context->setSetting("enable_alp_codec", true); |
There was a problem hiding this comment.
I agree with Nikita. I also plan to deprecate the setting soon, so long-term it doesn't matter
Set `CODEC(ALP, ZSTD(3))` as the generated `value` codec for both sample targets. Enable `ALP` in each internal creation context and recognize the codec as generated for both targets. Update the documented defaults and the `Float32` and `Float64` regression expectations, including round trips with `enable_alp_codec=0`.
ALP for TimeSeries sample valuesALP for TimeSeries samples and recent samples
Apply the codec to generated timestamps in both sample targets. Recognize historical and current generated codecs when copying table definitions.
Declare the timestamp type through `SAMPLES INNER COLUMNS` when copying a table, so the test exercises regeneration of the recent timestamp. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120589&sha=c273d12d9af62b7c0c37c05c455df59deab7c589&name_0=PR&name_1=Fast%20test #120589
Keep the new `tags_idx` text index alongside the `ALP` value codec in the `CREATE AS` expected output.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units9 translation units recompiled, 21 s compile time in total, 9 of them have a recent master baseline. |
|
📊 Cloud Performance Report
This PR changes the default compression codecs for auto-generated TimeSeries samples/recent-samples inner tables (timestamp to Delta+T64+ZSTD(3), value to ALP+ZSTD(3)), plus docs and tests. The only flagged query, TPC-H Q1, is a plain scan/aggregation that never creates or reads a TimeSeries table, so the change cannot plausibly touch its execution path. Combined with a noisy, era-unstable baseline (already marked low-confidence), the -20.3% delta reads as run-to-run variance rather than a real effect, so it is downgraded to not_sure. No genuine performance impact from this change is expected on these benchmarks. clickbench🟢 No significant changes tpch_adapted_1_officialFlagged queries (1 of 22)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. Debug info
|
|
The performance test doesn't even use the TimeSeries engine: |
ALP for TimeSeries samples and recent samplesDelta, T64, and ALP for TimeSeries sample tables
PromQL Compliance ReportBaseline: S3 master
Note: score is unchanged vs baseline. |
|
The two failed performance shards for
This matches the existing join-ordering regression introduced by #120176: relations without row estimates are costed as one row, leading to a poor join order. Fix #120762 is currently open and absent from the tested build. After it merges, merge Completed comparisons show eight PromQL improvements:
These comparisons had no faster, slower, or unstable entries in the preceding 30 days of direct The only flagged slowdown is ARM Related: #120762 Related: #120176 |
Use
CODEC(Delta, T64, ZSTD(3))for generatedtimestampcolumns andCODEC(ALP, ZSTD(3))for generatedFloat32andFloat64valuecolumns in the samples and recent samples tables ofTimeSeries. EnableALPin the internal creation context so the default works withenable_alp_codec=0. Explicit column declarations retain their codecs, andCREATE TABLE ASrecognizes historical and current defaults.Related: #120589
The measurements below isolate the
valuecodec change; the timestamp codecs remained unchanged. The combined timestamp and value defaults have not been benchmarked together.Measured on a dataset containing 413,232 series and 71.4 billion samples over 30 days.
valuecolumnvaluecolumnZSTDremains useful afterALP: on a stratified 120.3-million-row sample, it reduced the encoded values from 87.8 MB to 13.8 MB.All 40 queries returned matching results. For the 12 queries reading main samples, geometric-mean latency decreased 4.2% cold and 3.5% warm. The two 30-day CPU panels improved 13–14% cold and 9–11% warm. An additional eight-round check found
d09_7d_last_running_by_ns2.7% slower warm (958 → 984 ms). The 28 queries reading recent samples had essentially unchanged cold latency and 0.3% higher warm latency. Across all 40 queries, measured geometric-mean latency decreased 1.3% cold and 0.9% warm.Query measurements used the same release binary for both codecs on a Ryzen 9 9950X with 16 physical cores and local NVMe. Each query/codec had two rounds of one cold and two warm requests; results use the median cold time and the median of each round's best warm time. Cold runs restarted the server and evicted the measured files from the page cache. Only the
valuestreams were rewritten.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Use
Delta,T64, andZSTD(3)for generatedtimestampcolumns andALPfollowed byZSTD(3)for generatedvaluecolumns in the samples and recent samples tables of theTimeSeriesengine.Workflow [PR]
Sync PR [sync-upstream/pr/120454]
Version info
26.10.1.121(included in26.10and later)