Why time-series is a compression problem
Time-series storage is fast because appending in time order makes neighbouring values similar, which compresses well and lets whole chunks be dropped.
Time-series data is append-only and roughly ordered by time, so consecutive readings are similar and compress well. Gorilla-style encoders exploit that: timestamps shrink to differences of differences, and XORed floats cost almost nothing when values repeat. The consequence is that the same ordering that makes storage small also makes retention cheap, since expired data is dropped as whole chunks instead of deleted row by row.
A series is a stream of points that arrive in time order, so each point has a predecessor. When a sensor reports on a fixed schedule, the gap between timestamps barely changes, and delta-of-delta encoding stores only that change, which is zero for a regular interval. Floats follow the same logic through XOR: each value is XORed with the one before, and a reading that barely moves leaves mostly zero bits. Columns add the last step. A metric's values sit together in one stream, so a query for one metric over a time window reads only that column's chunks.
The abstraction hides how much the ratio depends on the data. Irregular timestamps produce large delta-of-delta values, and noisy floats flip many bits between neighbours, so the encoder that shrinks a steady metric barely helps a jittery one. Ordering is fragile too. Take a retention job that deletes expired rows one at a time from a normal table. Every deletion is a write that competes with ingest, so when the job runs long, latency climbs and dashboards lag while the queries themselves are fine. Dropping a chunk avoids that because it removes files instead of rows. Late data breaks the sequence in the same way: a reading that belongs to a closed chunk must be inserted into a run the encoder already finalized, so the chunk gets rewritten.
Start with the access pattern, not the product name. If queries read a time range over one or two columns and writes mostly append, a time-partitioned store fits. If the workload rewrites historical rows in place, it does not. Pick a chunk interval small enough that dropping one reclaims meaningful space, and large enough that each chunk holds many points. Implement retention by dropping whole chunks, never by deleting rows. Keep ingestion in time order, and batch late or backfilled readings into a rewrite of the affected chunks rather than inserting them one at a time. Check the compression ratio on real data, because regular intervals and stable values are what the encoders need.
- Gorilla footprint
- about 1.37 bytes per point
- Timestamp encoding
- differences of differences
- Float encoding
- XOR with previous value
- Chunk sizing
- set by time interval
- Retention cost
- one chunk drop
The Gorilla paper reports this size after delta-of-delta timestamps and XOR-encoded values. It shows how far a regular, slowly changing series can shrink.
This is the change in the gap between readings. It is zero when a sensor reports on a fixed schedule, so it costs almost nothing to store.
A value that barely changes leaves mostly zero bits. Stable metrics compress best.
A chunk covers a fixed span of time, so retention can drop it whole. The interval sets how many points share a chunk.
Dropping a chunk removes its files rather than each row, so the cost does not scale with row count.
The first schema for metrics looked like any other event table: a row per reading, a timestamp column, and an index on time. It worked at small scale. The trouble was volume. A device reporting every few seconds produces millions of points per series, and most of those points repeat or follow the last one closely, so the table held a great deal of redundancy.
The wall showed up in range scans. A query for one value over an hour still read entire rows, because every field lived together, even though only one column mattered. Storage grew, and reads were slower than the data volume justified. Engineers needed a layout that matched how the data was queried.
Gorilla's answer had three parts. It stored one column per metric, encoded each timestamp as a difference of differences, and XORed each float against its predecessor so repeated values cost almost nothing. The paper reports about 1.37 bytes per data point. The gains came from the data's regularity.
The non-obvious lesson is that time-series performance is a compression problem. The append-only, time-ordered write path that makes compression work is the same property that makes retention a chunk drop, so one design decision serves both costs. When the write order changes, both the size and the cost of deleting history change with it.