Skip to content

Research notes / Time-series storage

Time-series rollups: equal summaries, different data

Published / Updated / Source review, exact arithmetic and native controls

An unchanged aggregate is not evidence that a time series is unchanged. A rollup can be correct for its version and still hide changes to individual samples. Preserve the stream version, window boundaries and counts alongside the summary.

On this page12 sections

A tree that remembers versions

BTrDB, presented at FAST 2016, partitions time in a copy-on-write tree. Leaves contain time-value pairs; internal nodes contain summaries. Updated paths lead to a new root, retaining earlier versions. Version annotations support locating modified ranges without scanning all raw samples. Aggregate queries and change queries serve different purposes. [1, sections 3-4]

The paper's large-range latency evaluation returns 2048 statistical records at varying resolutions, not every underlying sample. It also distinguishes the production deployment from its optimized experimental version. Those results are not a current latency guarantee; we did not reproduce them. [1, section 6.3]

Three sequences, one summary

Consider four samples at offsets 0, 1, 2 and 3 nanoseconds in the same window. Values below are invented, in arbitrary units. Every row has four observations, a sum of 20, minimum 0, maximum 10 and mean 5.

Exact synthetic examples. All timestamps are the base 1700000000000000000 ns plus the listed offsets; these are not measurements.
SequenceValues at offsets 0, 1, 2, 3 nsCountMeanPeak offset
rising0, 2, 8, 10453 ns
falling10, 8, 2, 0450 ns
redistributed0, 4, 6, 10453 ns

The rising and falling sequences even contain the same multiset of values. Reversing their order preserves every order-insensitive statistic, but moves the peak from 3 ns to 0 ns. The redistributed sequence changes the interior values while retaining the four reported statistics. A finer query can reveal these differences; the coarse summary cannot recover information it does not encode.

This is a constructive counterexample, not a BTrDB bug. It proves that equality of these summaries is insufficient for raw-data equality. It does not estimate how often the ambiguity occurs in real telemetry.

A mean needs its count

Suppose one window contains [0] and another contains [10, 10, 10]. Their means are 0 and 10. Averaging those two means gives 5, but pooling the four samples gives 7.5: (1 * 0 + 3 * 10) / (1 + 3).

The first answer weights windows equally; the second weights observations equally. Neither is automatically a time-weighted mean of an irregularly sampled physical signal. That requires a stated interpolation or duration model. The downloadable program uses exact integer sums and counts before presenting the small decimal result.

Cumulative reports already share observations

Aggregation temporality distinguishes new reporting intervals from accumulation since a fixed start. OpenTelemetry attaches it to sums and histograms, not gauges. Consecutive cumulative reports are overlapping histories, not disjoint batches. [19]

Our constructed duration stream first records [1, 100] ms. Its next interval contains either [10, 20] or [14, 16] ms. Both later cumulative reports have the same count, sum, extrema and bucket counts at the 50 ms boundary. Reporting times below are arbitrary second offsets; intervals use (start, end]. Durations remain in milliseconds.

Exact constructed values, not SDK output or device measurements. Buckets are at most 50 ms and above 50 ms. Unknown extrema are not zero.
ReportInterval (s)CountSum (ms)BucketsMin / max (ms)
First cumulative(100, 110]21011, 11 / 100
Later cumulative A or B(100, 120]41313, 11 / 100
Difference of snapshots(110, 120]2302, 0Not recoverable
Actual new interval A(110, 120]2302, 010 / 20
Actual new interval B(110, 120]2302, 014 / 16

Adding the two cumulative counts gives 6, although the later report contains only 4 observations. Compatible subtraction recovers two new observations with sum 30 ms and mean 15 ms. It cannot decide whether their extrema were 10/20 or 14/16 ms. This is missing information, not a rounding error. The data model likewise warns that cumulative-to-delta conversion cannot generally recover histogram minima and maxima. [20, Histogram]

The reverse direction is different: merging adjacent delta reports with known extrema can retain their minimum and maximum. Empty intervals add no extrema; a nonempty interval with an unknown minimum cannot be treated as zero or silently ignored. A skipped cumulative export can still leave the longer interval's count and sum recoverable, but not its unreported shorter-window breakdown.

A changed accumulation start needs reset handling, even if all new counters exceed the previous ones. A missing delta interval is not an observed zero. Retain source identity, units, timestamps and compatible bucket boundaries. Detailed reset and overlap policies in the reviewed specification are still Development; our example's rejection rules are not a universal collector requirement. [19] [20, Resets and Gaps; Overlap]

The exact-integer model, tests and method and limits distinguish adjacent deltas from cumulative snapshots. The fixture rejects reset boundaries, replay, layout mismatches and missing delta coverage. It does not execute OTLP or verify source completeness. This is not a claim that BTrDB uses OpenTelemetry.

Mergeable does not mean replaceable

A quantile sketch retains distribution information for approximate percentile queries. DDSketch bounds relative-value error rather than rank displacement. This approximation concerns its input observations, not a population confidence interval. Its bounded variants can lose accuracy in collapsed bins. [6, sections 1-2]

The reviewed Java implementation requires equal index mappings for a merge and adds counts. That check does not validate window identity or version. [7, mergeWith] Our engineering implication: choose the intended contributions before combining them.

Constructed example: two disjoint windows, A and B, each contain three invented request durations in milliseconds. A v1 is [1, 1, 100]; its replacement A v2 is [1, 1, 1]. B v1 stays [2, 2, 2]. These are alternative versions of A, not six distinct requests in A.

Exact input populations, not DDSketch output or device measurements. p90 uses nearest rank: sorted observation ceil(9 x N / 10), one-based.
ContributionsCountp90 (ms)
A v1 + B v16100
A v2 + B v162
A v1 + A v2 + B v19100
2 x (A v2 + B v1)122

Adding the replacement to the old total retains a superseded 100 ms request. Replaying the correct population twice leaves this p90 unchanged while doubling its count. Neither a successful merge nor an unchanged percentile proves that each intended request was counted once.

This does not mean all sketches prohibit deletion: the paper's unbounded fixed-bin construction supports it. The reviewed Java accept API rejects negative counts. [6, section 2.1] [7] Use an explicitly supported removal protocol with retained contributions, or rebuild from the selected window versions. Do not infer subtraction support from merge support.

Keep units, timing population, half-open window bounds, source identity, version and coverage with the sketch. Record its mapping and store policy: unbounded growth and bounded-bin collapse have different trade-offs. [8] This is not a claim that BTrDB uses DDSketch.

Download the population calculation and regression tests; run node --test quantile-rollup-versions.test.mjs with both files together. The example implements no sketch, approximation or storage engine. The paper's lower-quantile convention differs from our stated nearest rank; neither convention supplies missing version provenance.

A distinct count can retain the wrong window

HyperLogLog estimates distinct identities rather than percentiles. Compatible register arrays combine by taking maxima. Repeating the same union leaves those maxima unchanged, but an ordinary register-only sketch cannot generally subtract a retired bucket. Extra retained state can support other window designs. [13]

The loss is visible in four illustrative register coordinates. Let A = (4, 1, 0, 0), C = (4, 2, 0, 0) and the retired bucket B = (2, 3, 0, 0). Both max(A, B) and max(C, B) give (4, 3, 0, 0). Even with B retained, that union cannot tell whether A or C should remain. These are constructed coordinates, not measured hashes or cardinality estimates. The executable algebra example shows why retaining the original buckets, or additional window state, matters.

Redis PFMERGE includes an existing destination in the union. Reusing yesterday's aggregate therefore keeps its old contributions. The pinned implementation also accepts an absent source as empty. [9] [10] These are population-selection problems, separate from the estimator's uncertainty for the selected population.

The constructed Redis 7.2.4 experiment starts with 100 old identities and 10 retained identities. The old source expires, then 10 new identities enter. The intended next window is the 20 retained-plus-new identities. Both sparse and forced-dense controls produce:

Constructed native results, not field measurements. Exact size describes the intended active set; both reported counts are estimates.
OperationExact sizeSparse estimateDense estimate
Reused destination20120120
Fresh destination202020
Missing active source201010
Guarded replacement202020

The missing-source control removes a still-required bucket, not a bucket legitimately outside the window. An explicit empty bucket produces the same aggregate, so the count cannot certify coverage. A fresh destination corrects stale state only when the selected sources are complete.

The supplied single-server helper requires sealed sources and a private scratch key, validates inputs, builds a fresh union and renames it over the target. Its output is persistent; it does not preserve an old target expiry. Script isolation is not rollback or durability, and the helper does not prove ingestion completeness or cross-server consistency. [11]

A separate control inserts a distinct 184th identity while PFADD returns 0 and the cached sketch bytes remain unchanged. A no-op is not an exact duplicate decision: do not use it to discard supposedly redundant chunks. Nor does return 1 always mean a nonzero count: creating an empty sketch returns 1 with count 0. [12] [11]

Download the source-pinned reproduction package, method and limits and table data with source hash. The replay builds an isolated historical Redis version with TCP disabled. It is not a production-version recommendation, an accuracy bound or a new Redis defect.

Zero overlap is not proof of disjoint data

Theta sketches retain sampled hashes and can estimate intersections. The framework aligns samples to a common threshold; its guarantees depend on the sampling rule and ideal random hashing. This is a different contract from HLL register maxima, not a claim that BTrDB uses Theta. [14]

In our constructed Apache DataSketches Python 5.2.0 control, two sets of 10,000 integer identities share exactly one value. At nominal k=32 and seed 9001, the intersection estimates zero but has empty=false and a two-standard-deviation upper bound of 1092. That is an approximate library bound, not a deterministic maximum. Replacing this sampled-zero state with a fresh empty sketch erases the uncertainty. Native serialization preserves it. [15]

Keep the threshold, empty flag, encoding and seed with the result. Query its own bounds; a precise input count does not guarantee a precise small overlap. Neither an exact empty offered set nor a sampled zero proves ingestion completeness. Use exact manifests or reference checks for deletion decisions. The method, controls and limitations and offline replay include all 768 seed-sensitivity cases; these are not fleet measurements.

Signed corrections need a known contribution

A turnstile stream allows positive and negative frequency updates. Strict turnstile keeps every true per-key balance nonnegative; general turnstile permits negative balances. Ordinary additive Count-Min with a minimum estimator still supports valid deletions in the strict case. Its general-case median variant has a different contract. [18, sections 2-4.1]

CountSketch assigns each key a bucket and sign in each row. Updates add the signed increment; queries take the median of signed bucket values. Its arrays can be added or subtracted under identical maps and exact arithmetic. That linearity does not extend to adding median estimates. [16, sections 3-4]

The following constructed maps force x and y to collide in every row. For CountSketch, all three rows use the stated sign relationship. These deliberately chosen maps show possible errors, not their frequency under random hashing. All counts are dimensionless integer weights.

Exact constructed arithmetic. Valid removal: x:+5, y:+3, y:-3. Negative balance: x:+5, y:-3. Both CountSketch rows below use x:+5, y:+3.
ConstructionTrue xQuery x
Count-Min minimum, valid removal55
Count-Min minimum, negative y balance52
CountSketch, opposite collision signs52
CountSketch, matching collision signs58

The CountSketch estimates can fall on either side of 5. Its statistical error bounds depend on the full frequency vector and hash assumptions, not just this key's count. The table does not test those bounds. At a common failure probability, the usual bounds require width proportional to 1/epsilon^2 for CountSketch versus 1/epsilon for ordinary Count-Min. A smaller norm alone therefore does not establish a winner at equal memory. [17, sections 5.3.2-5.3.2.1]

Now compare histories (time 0, x), (time 10, y) and (time 0, y), (time 10, x), each event weighted +1. Both yield the same vector and sketch. Expiring time 0 leaves only y in the first history and only x in the second. Even exact final counts omit this ordering information: subtraction needs retained events, time buckets or another explicit expiration mechanism.

For corrected telemetry, retain the old contribution and its version before replacing it. Agree on units, key encoding, dimensions and bucket/sign maps; prevent counter overflow and saturation. Replaying an update counts it again. Neither algebraic cancellation nor a plausible estimate validates the removal or deduplicates ingestion. These are engineering implications of the stated model, not a claim that BTrDB implements CountSketch.

The finite-map calculation and exact regression tests run with node --test model.test.mjs beside the module. Tests include signed merge, undo, median nonlinearity and expiration. They are synthetic demonstrations, not a production sketch or storage benchmark.

Window identity and query completion

Python client v5.34.2 documents aligned windows of 2**pointwidth nanoseconds, half-open time bounds, boundary alignment and omission of empty windows. An absent row is not a zero-valued sample. Its annotation-version counter is distinct from the data-stream version. [2]

Our aligned fixture requests three 1024 ns windows and returns one nonempty window. Two are absent; a point exactly at the end boundary is excluded. The example requires already aligned bounds, rather than imitating every client adjustment. Integer nanoseconds are retained as decimal strings in JSON and BigInt in the calculation: adjacent timestamps at this scale can collapse to the same JavaScript Number.

The Go v5.17.1 contract widens changed ranges at coarser resolution. Treat such ranges as areas to revisit, not exact changed-sample lists. Version zero requests the latest stream version; retain the actual returned version for repeatable analysis. Receiving values is also not proof that a streamed query finished successfully: consume the value channel and check its final error. [3]

Compression preserves samples only with decoding state

Rollups deliberately omit detail; lossless timestamp coding has a different contract. Delta encoding retains an initial value and successive differences. Delta-of-delta encoding also retains the first interval and encodes its later changes.

Our invented timestamps are 1000, 1010, 1020, 1031 milliseconds from an arbitrary origin. First differences are 10, 10, 11; second differences are 0, 1. Keep those second differences fixed and change only the initial state:

Exact integer illustration, not encoded file sizes or observed failures. All values are in milliseconds.
Initial stateFirst timestampFirst intervalReconstructed timestamps
Correct state1000101000, 1010, 1020, 1031
Wrong initial timestamp1100101100, 1110, 1120, 1131
Wrong initial interval1000111000, 1011, 1022, 1034

The first wrong state shifts every timestamp; the second introduces growing drift. Valid arithmetic is not proof of the intended sequence. A restart point needs sufficient preceding state or an independently decodable block; second differences alone are insufficient.

More generally, number samples from zero. If the initial timestamp is wrong by a and the initial interval by b, unchanged second differences reconstruct an error of a + i*b at sample i. Adding that linear trend leaves every second difference unchanged. This is an exact-integer derivation checked by the downloadable tests, not an observed corruption rate.

Therefore, hashing only the residuals cannot distinguish these sequences: the hash input is identical. Integrity verification must also cover the decoding state, sequence length and interpretation, such as timestamp units, or verify the fully reconstructed representation. This does not show that either cited file format lacks its own integrity protections.

Gorilla's 2015 timestamp format uses block initial state and variable-length codes for second differences, separately from its floating-point XOR coding. Constant intervals yield zero second differences; jitter changes them. This is a format comparison, not a claim that BTrDB uses Gorilla's encoding. [4, section 4.1.1]

Parquet's DELTA_BINARY_PACKED instead subtracts a block minimum from first differences and bit-packs the residuals. That is not second-order differencing. Its fixed-width overflow rules also differ from this example's unbounded integers. [5]

Download the exact-integer module and round-trip tests. Run node --test delta-transforms.test.mjs beside the module. Smaller residual numbers alone do not prove smaller files: the code does not implement either wire format, metadata cost or a native codec benchmark.

Reproduce and interpret

Download the generated evidence JSON, calculation module, tests and generator. Run node --test btrdb-rollups.test.mjs with the module beside it. No external service, package installation or dataset is required.

These deterministic examples have no sampled population or confidence interval. They do not exercise BTrDB duplicate policies, tree recovery, rounding of floating-point measurements or concurrent updates. The relevant engineering check is narrower: do not use a summary comparison as a substitute for source identity and a complete query.

Related: storage consistency and ordering, numeric precision at import boundaries and the copy-on-write definition.

Sources and scope

  1. Andersen and Culler. BTrDB: Optimizing Storage System Design for Timeseries Processing. FAST 2016, pp. 39-52, sections 3-4 and 6.3.
  2. BTrDB Python v5.34.2 documentation: aligned_windows and stream annotations.
  3. BTrDB Go bindings v5.17.1: Changes, LatestVersion and query-channel completion.
  4. Pelkonen et al., Gorilla: A Fast, Scalable, In-Memory Time Series Database, PVLDB 8(12), 2015, section 4.1.1
  5. Apache Parquet format: DELTA_BINARY_PACKED encoding
  6. Masson, Rim and Lee. DDSketch: A Fast and Fully-Mergeable Quantile Sketch with Relative-Error Guarantees. PVLDB 12(12), 2195-2205, 2019. DOI 10.14778/3352063.3352135; sections 1-2.
  7. DataDog sketches-java, commit 0f403e84572be0c38e5a3e955986c4f436404204: DDSketch accept, mergeWith and getValueAtQuantile.
  8. DataDog sketches-java, commit 0f403e84572be0c38e5a3e955986c4f436404204: DDSketches mapping and bounded/unbounded store contracts.
  9. Redis command reference: PFMERGE includes an existing destination.
  10. Redis 7.2.4 pinned implementation: PFMERGE, PFADD and absent-source behavior.
  11. Hesela: native HyperLogLog window controls, exact fixtures, source-pinned replay and limitations.
  12. Redis command reference: PFADD return values and empty-key creation.
  13. Flajolet, Fusy, Gandouet and Meunier (2007), HyperLogLog: the analysis of a near-optimal cardinality estimation algorithm. Figure 2 and p. 143, footnote 4: register maxima and distributed union.
  14. Dasgupta, Lang, Rhodes and Thaler. A Framework for Estimating Stream Expression Cardinalities. ICDT 2016, sections 2 and 3.7.
  15. Hesela: Theta intersections, native synthetic controls, all seed-sweep rows and uncertainty limits.
  16. Charikar, Chen and Farach-Colton. Finding Frequent Items in Data Streams. Sections 3-4, including additive sketches and frequency changes.
  17. Cormode, Garofalakis, Haas and Jermaine. Synopses for Massive Data. Author manuscript, sections 5.2 and 5.3.2.
  18. Cormode and Muthukrishnan. The Count-Min Sketch and its Applications. Author preprint, 16 December 2003, sections 2-4.1.
  19. OpenTelemetry Protocol metrics.proto: Sum, Histogram, ExponentialHistogram and AggregationTemporality; pinned d31f7acf.
  20. OpenTelemetry Metrics Data Model: Histogram, Temporality, Resets and Gaps, Overlap; pinned a0c5323b.

BTrDB sources checked 14 November 2026; timestamp-encoding sources checked 17 November 2026; quantile-sketch sources checked 20 November 2026. Original code and synthetic examples: CC0. Source publications retain their rights. The 2016 design and later client contracts are separate versions, not one executed experiment.

Published by Hesela team · Published · Updated

Report a correction · Editorial standards · Reuse guidance

Change history

: first published.

: latest recorded update. A detailed change note is not available for this revision.

New-publication RSS · Correction RSS

Cite this page
Hesela team. Time-series rollups: equal summaries, different data. Hesela. 2026-11-20. https://hesela.com/analyses/time-series-rollups-versioned-changes/