Repository navigation
Switch the samples inner table of the TimeSeries engine to a bucketed schema - #117344
Conversation
|
Workflow [PR], commit [819b40d] Summary: ❌
AI ReviewSummaryThe PR introduces version 11 of Findings❌ Blockers
Tests
Final Verdict❌ Block. Preserve bucket identity under custom merge keys and keep legacy definitions attachable. Address the remaining creation and slicing failures with focused regressions. Previously dismissed findings remain summary-only; no inline comments or thread replies were posted in this run. |
0226aa6 to
e23c7c6
Compare
| return lut[toLUTIndex(v)]; | ||
| } | ||
|
|
||
| /// Round `value` down to a multiple of `divisor` (towards negative infinity). |
There was a problem hiding this comment.
Function DateLUTImpl::roundDownToMultiple was just made public, because I need it for bucket calculations
e23c7c6 to
f0e2ee1
Compare
b7d0568 to
15c4f3b
Compare
15c4f3b to
f858f39
Compare
Build profile diff (arm_release)Comparing commit See the job log for details. |
f858f39 to
cc55590
Compare
|
Measurements on this PR's samples schema: short windows over many series depend on the recent table, and a time-bucket prefix in the main sort key would serve them at close to recent-table speed from one table. I rewrote 7 days of synthetic node-exporter data (19,800 series, 15 s interval, 798M samples) into the PR's layout: one row per series-hour with
¹ Longer than the 4-day TTL, so the PR reads the main table. A 512 KiB granule of the main table holds about 135 hours of one series, so a 1 h window over 200 series still reads 200 granules. Short windows outside the recent table's TTL, or with the recent table disabled, pay this cost. A time-bucket prefix avoids it without writing every sample twice or keeping 5 h partitions. The trade-off is long single-series ranges, which read one granule per time block: 7 days of one series take 36 ms instead of 6 ms with a 6 h prefix. A day prefix keeps that at 13 ms but is 3.4× slower than the recent table on the 12,800-series 6 h window. The same held for today's row-per-sample layout on a 25-query PromQL suite over 7 days of data. Without a recent table, a time-prefixed samples key matched the recent table on the short queries (a 6 h prefix on all of them, a day prefix on the 1 h windows). The day prefix also matched it with 20 unmerged insert parts, and inserts through the TimeSeries engine took 27% less time because each sample is written once. Limits:
I can share the scripts to reproduce this. |
|
Dear @nikitamikhaylov, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
PromQL Compliance ReportBaseline: S3 master
Extended support (upstream engine tests): native-histogram exclusions: 149; excluded assertions: 248; upstream Note: Prometheus compliance score is unchanged vs baseline. |
fd18c2b
|
@snelheidai, regarding to #117344 (comment): the PR was changed a lot since then and before merging, remeasure performance with your tests |
|
Remeasured on the merge commit fd18c2b against its parent 0525e0c (CI release builds, one 4-vCPU x86 VM). The data is the same synthetic node-exporter set as before (19,800 series, 15 s interval, 7 days, 798M samples), now ending an hour before the run so that the default 4-day recent table is used, with engine defaults on both builds and merged parts. The queries are the 25-query PromQL suite from before, 7 queries over 1–7 days, and 7 short windows moved 5 days back so that they read the main table. Each query ran 7 times per build, interleaved; times are client-side latencies of the Prometheus HTTP API. 25 of the 38 valid queries are faster on the merged build (0.55–0.93×), 11 are unchanged within the 95% interval, and 2 are slower:
Both builds return the same series and timestamps for every query: 26 results are identical, and the 12 that sum floats in a nondeterministic order differ by at most 2.4e-14 (relative), as much as repeated runs of one build. Q23 fails on both builds because dropping Writes are cheaper, and storage is unchanged:
On the table filled by these 72 INSERTs (6 main and 8 recent parts with partial buckets), 19 of the 24 short queries are faster (0.70–0.93×), 4 are unchanged and Q21 is slower (1.15× [1.03, 1.29]). The results again agree with master. The L4 regression is in the adaptive
With the byte bound off, all 9 queries in that comparison are faster on the merged build than on default master, including L4 (0.58× [0.51, 0.65]), Q21 (0.92× [0.86, 0.99]) and Q19 (0.83× [0.79, 0.87]). So turning the byte bound off for the per-series Short windows older than the recent table's TTL (the O queries) are 0.70–0.91× of master. On both builds, the many-series ones still take 1.8–7.8× as long as the same windows inside the TTL, because a main-table granule holds about 135 hours of one series. That is the case the time-bucket prefix in my earlier comment was about; this PR does not change it. All 38 queries (7 runs per build)
The storage-level reads from my earlier comment, on the real tablesSame hand-written SQL as before: count and sum of the selected series' samples in the window, with
The September emulation of the PR's main table measured 195 ms, 6075 ms and 6.3 ms there (another VM, an older build, |
Since ClickHouse#117344 the samples table of a new TimeSeries table stores buckets of samples, so timeSeriesData() has no `value` column any more and the test failed with "Identifier 'data.value' cannot be resolved". Read the value from the `samples` array instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Since ClickHouse#117344 timeSeriesSelector requires its return_columns argument, so the test failed after the merge with master. 'timestamp_and_value' gives the columns the test read before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Since ClickHouse#117344 timeSeriesSelector requires its return_columns argument, so the test failed after the merge with master. 'timestamp_and_value' gives the rows the test counted before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ential-smoothing Master's ClickHouse#117344 replaced the raw-data store method RAW_DATA with SAMPLES and TIMESTAMP_AND_VALUE, so the factor switch of double_exponential_smoothing names the two new store methods. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d-window Master's ClickHouse#117344 split the raw-data store method into SAMPLES (bucketed tables, now the default) and TIMESTAMP_AND_VALUE (tables of version 10 and earlier). The fused metric-name drop now applies to both. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ClickHouse#117344 switched the samples inner table to the bucketed schema of version 11 (id, samples, bucket, min_time, max_time), so the fixture's `INSERT INTO FUNCTION timeSeriesSamples(ts) SELECT id, timestamp, value ...` fails on current master with NUMBER_OF_COLUMNS_DOESNT_MATCH (source: 3 and result: 5). Insert the samples through the TimeSeries table instead, which works with every samples layout. The reference is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Since ClickHouse#117344 a TimeSeries table of the latest version (11) stores buckets of samples and requires an engine of the AggregatingMergeTree family for its samples table, so `SAMPLES ENGINE = File(Parquet)` is rejected with INCORRECT_QUERY and the test failed on every run against current master (the merge queue flaky check of this PR). Version 7, the latest one on this branch's base and still supported on master, stores one sample per row in any engine, so the arm keeps all three targets in File(Parquet) and the same queries on both trees. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A row of the samples table holds one hour of one series (ClickHouse#117344), so with `index_granularity_bytes = 524288` a granule is about 135 hours of one 15 s series and a short PromQL window older than the recent samples table reads whole granules. Change the default of `samples_index_granularity_bytes` to 262144 and update its documentation and the tests that check the default. Measured on the CI amd_release binary of 9b41283 with the data set of ClickHouse#131459 (19,800 series, 14 days, byte counters with random decimals), max_threads = 4, 15 interleaved reps, ratio = 262144 / 524288: - O19 rate(node_cpu_seconds_total[5m]), 1 h range 5 days back: 0.670 - O23b sum(count_over_time(node_cpu_seconds_total[6h])): 0.696 - W1 / W3 / F4 / F6 long scans: 1.170 / 1.140 / 1.181 / 1.266 - marks 49,282 -> 99,299, samples table on disk +1.0% Existing tables keep their stored `index_granularity_bytes`. The setting exists only on master, so no compatibility handling is needed. Adds the perf test promql_selector_old_short_window.xml. Closes: ClickHouse#131459 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Switch the samples inner table of the TimeSeries engine to a bucketed schema:
The
recent samplestable has the same columns and codecs. It differs only in the engine clause: five-hour partitions, the TTLtoDateTime(bucket) + toIntervalSecond(346500), andindex_granularity_bytes = 131072.Workflow [PR]
Sync PR [sync-upstream/pr/117344]
Version info
26.11.1.841-master(included in26.11and later)