Time-series · Engineering
Designing time-series storage for small deployments
Buckets, series, and time windows: how NonoDB’s time-series profile differs from one document per sample.
A time-series database is usually introduced when a table of timestamped rows becomes too large to scan. The first design is often a document per sample: timestamp, device id, a few measurements. It is simple, familiar, and surprisingly expensive.
NonoDB’s time-series profile stores samples in buckets instead. A bucket groups one series and one time window, and each field inside the bucket is a typed column rather than a repeated JSON key.
The model
Create a collection with profile: "timeseries" and at least a timeField:
{ "op": "create_collection", "coll": "readings", "profile": "timeseries", "timeseries": { "timeField": "ts", "metaField": "device", "granularity": "seconds", "compression": "balanced" }}timeFieldis the event time.metaFieldgroups rows into series. The value is stored once per bucket.granularitysets the bucket width preset:seconds= 1 hour,minutes= 1 day,hours= 30 days.bucketMaxDocsseals a bucket at a row count (default 2,048, max 16,384).bucketMaxBytesseals it at an encoded size (default 512 KiB, max 4 MiB).compressioncontrols zlib effort:fast,balanced, ormax.expireAfterSecondsenables read-time expiry relative to the event time.
A high ingest rate produces more buckets per window rather than an unbounded open bucket. That keeps one hot bucket from growing forever.
Why buckets help
A document per sample stores field names on every row. A bucket stores metadata once and keeps each measurement field as a column. Repeated strings can be dictionary-encoded, monotonic timestamps can use delta encoding, and booleans can be bit-packed.
The result is a storage footprint closer to a columnar TSDB while keeping a document API. Inserts and reads still look like ordinary JSON documents; the bucket layout is an implementation detail.
On the published 100k-row workload, the compacted time-series copy is about 1.02 MB (10.69 bytes/row), versus 41.59 MB (436.1 bytes/row) for an ordinary collection. That number is a compacted copy: the live LMDB file keeps its high-water mark until compaction. Sealed data before compaction was about 8.18 MB in the same test.
Open and sealed buckets
New rows go into an open bucket. Open buckets are uncompressed because they are still being appended. When a bucket reaches its row or byte limit, it is sealed and encoded.
That trade-off matters:
- inserts are cheap while the bucket is open;
- sealing costs CPU and happens in the background;
- sealed data compresses well;
- updates and deletes may need to rewrite a sealed bucket.
The bucket limits bound the amount of uncompressed data at any moment. With the default 2,048 rows per series, at most that many rows per series are uncompressed.
What the profile is not
The time-series profile is not a separate database engine. It is a collection profile inside the normal document database. It shares the same writer, indexes, TTL, history, events, backup, replication, and authorization model.
It is also not a full TimescaleDB replacement. Bulk ingest is lower, point updates and deletes are slower, and dedicated TSDBs have more mature continuous aggregation and operational tooling. The next posts cover timestamps, codecs, retention, and the comparison in detail.
One profile, many collection settings
Different series can live in different collections with different bucket limits and compression settings. A high-frequency sensor collection can seal earlier than a low-frequency business-metrics collection. That flexibility is useful, but it also means bucket tuning is a per-collection decision, not a global database mode.
When it fits
Use time-series collections when:
- data is append-heavy and queried by series and time range;
- the deployment is small or mid-size;
- you want telemetry next to ordinary documents;
- retention and storage footprint matter more than point-update latency.
Use a dedicated TSDB when very high ingest, continuous aggregates, or PostgreSQL-centric operations dominate. The goal is not to win every workload; it is to avoid a second system when the workload fits.
The time-series guide and benchmark page cover the profile settings, codecs, and comparison methodology.