Ray's Knowledge Base
Unlock

The index stores numeric values as exact decimal-to-integer delta columns, not per-second summaries

DecisionVerified 5 Nov 2026Holds project: dftracer-utils
Decision. The context, the choice, why, and the options that were turned down.

Context#

On the matrix set the index was 3.76 GB, and 3.2 GB of it were per-second summary rows of counter samples. Those rows hold 152 M cells for 297 M values (about 2 values per cell, since the sampler writes every 0.5 s). Each cell stores a count and 6 doubles, so the summary was larger than the raw data (297 M values at 8 bytes is 2.4 GB). The index budget is 1 to 2% of the trace text.

Decision#

Store every numeric leaf path of a chunk as an exact column. Timestamps use delta-of-delta. Values use an ALP-style step: decimal to integer, delta, varint, then the store's compression. A value that does not round-trip stays a raw double, so the column is always exact. The path is picked automatically, by frequency and byte cost within a budget, and no schema declares it. A path left out re-parses only the chunks that contain it. Percentiles come from sketches in coarse rows only, never from averages.

Why#

Measured on 800 files each, in bytes per value: raw doubles with zlib level 1 gave 4.24 (matrix) and 1.96 (tuolumne), Gorilla XOR gave 4.12 and 2.11, and the ALP-style step gave 0.38 and 0.53. All numeric paths as columns cost 1.45% (matrix), 1.70% (tuolumne) and 0.37% (68 GB set) of the text. Samples sit between events in the same gzip chunks, so a targeted re-parse inflates whole chunks and costs about as much as a full scan.

Rejected options#

  • Plain compression of raw doubles: about 1.26 GB on matrix, over budget.
  • Gorilla XOR: no better than plain compression on this data.
  • A schema that declares which records are samples: the data is then no longer schemaless.
  • Sketch per chunk with the per-second rows kept: the per-second stats were the cost, not the sketches.

Also found by searching

  • how should the index store counter samples
  • per-second summaries are bigger than the raw samples
  • store numeric trace values exactly in the index
  • index size budget 2 percent of the trace text