Repository navigation
Conversation
- scripts/test_clickhouse_baselines.py: the generator's PromQL rule shapes, the five variant directories and their flags, one view per query, buckets. - tests/clickhouse_hand_written.rs: the engine's reader of a hand-written deployment file. - tests/clickhouse_baselines_conformance.rs (#[ignore], real server): every variant against an in-test PromQL oracle on the showcase suites and on a counter with resets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1M6boFpwkpMtRc1FnZuYi
… as variants of the clickhouse engine
- scripts/clickhouse_baselines.py writes five variants into a run
directory: clickhouse.native, clickhouse.hand-mv,
clickhouse.sketch-functions (quantileTDigest),
clickhouse.sketch-functions-dd (quantileDD 0.01) and clickhouse.sketch-mv
(quantileTDigestState), with a rule per PromQL shape.
- The clickhouse engine installs a hand-written deployment
({"clickhouse_hand_written": ...}) as well as a planner plan file; an
approximation is reported as a substitution.
- docs/clickhouse-baselines.md: the rule table, error parameters and where
ClickHouse cannot match PromQL.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6boFpwkpMtRc1FnZuYi
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
suites/showcase-1m,showcase-1h) had no QuestDB lane, so the paper's E2E baselines lacked a time-series SQL database with materialized views and approximate functions.questdbforapproxbench benchmark-external run, with three variants as a QuestDB user writes them:questdb.native(query-time SQL, exact),questdb.materialized-views(one incremental view per query, exact),questdb.approximate(approx_percentile).sum by (job) (rate(requests_total[1m]))costs 117.7 ms server CPU per evaluation natively vs 32.9 ms over a view, both exact;quantile_over_time(0.99, latency[1m])costs 35.0 ms exact vs 78.9 ms withapprox_percentile(max relative error 0.11).Review guide
Base
main(e4a9111), not stacked. Read first:questdb.rs: PromQL text → QuestDB SQL per variant (window semantics, rate formula, view rules). Needs careful review.questdb_server.rs: HTTP adapter (ILP ingest + wait for WAL apply / view refresh,/execqueries, footprint, drop).tests/questdb_conformance.rs: real-server cases against a PromQL reference.Mechanical: registry entry,
mod.rs, docs table row,scripts/extbench-up-questdb.sh(copy of the VictoriaMetrics script's shape),scripts/questdb_variants.py.Behavior: before → after
Before:
unknown engine 'questdb'. After: one cell per (workload, variant), joined bybenchmark-external reportwith the other engines. A variant whose SQL would equal native's is a no-plan cell (approximate: no quantile query; views: only quantile queries).Semantics vs PromQL:
(T−w, T]: native/approximate usets > T−w AND ts <= T.SAMPLE BYbuckets are[s, s+b), so the views arm stores each sample 1 µs early; with whole-ms data,(T−w, T]is exactly the buckets starting in[T−w, T)(b = gcd(window, interval), checked to divide the data start).quantile_over_time=percentile_cont(linear interpolation, PromQL's). Quantiles have no mergeable per-bucket state, so in the views variant they read the raw table.rate/increase= Prometheus v3extrapolatedRatein SQL (lag/leadfor resets), the ClickHouse translator's formula. Views keep per-bucket count, min/max ts, first/last value (window functions are not allowed in a view), so a counter reset inside one bucket is missed: recorded as a substitution; suite counters never reset.approx_percentile(value, q, 2): HdrHistogram at 2 significant digits (1 % value resolution, the suites' 1 % target), nearest-rank, so its error vs the interpolated truth is measured by the report./write?precision=u), then wait untilwal_tables()writerTxn = sequencerTxn and every view'srefresh_base_table_txnreached it (REFRESH IMMEDIATE), so refresh work is ingest CPU.QUESTDB_PARALLEL_SQL=off, like ClickHousemax_threads=1); settings are recorded in the engine's build profile.Interfaces
questdb.rsquestdb_server.rsPlan file format (new):
{"questdb_variant": "native" | "materialized-views" | "approximate"}. CLI:--engine questdb,--questdb-url,--questdb-request-timeout-seconds.Algorithm
None beyond the SQL rules above (no planner involvement).
Decisions and open questions
WITH OFFSET(offset granularity is minutes).approx_count_distinctexists (HyperLogLog, int/long/IPv4) but no suite query asks a distinct count; NaN samples are refused (QuestDB stores NaN as NULL).Verification
cargo test -p system-bench --lib questdbcargo test -p system-bench --lib registrypython3 -m unittest scripts/test_questdb_variants.pytests/questdb_conformance.rs(real server,--ignored --test-threads 1)cargo clippy -p system-bench --tests,cargo fmt --checkConformance (QuestDB 10.2.0 in docker, 8 cores, one-thread queries):
E2E:
approxbench benchmark-external run --engine questdb --warmup 0 --runs 1over showcase-1m, report with truthquestdb/questdb.native: all 17 planned cells ran; views err 0.000 on every workload; approximate max relative error 0.110 (quantile), 0.233 (joint).Follow-ups
QUESTDB_PARALLEL_SQL=onas an extra row if the comparison wants QuestDB's parallel execution.🤖 Generated with Claude Code
https://claude.ai/code/session_01K1M6boFpwkpMtRc1FnZuYi