Engineering · Time-series

Time-series collections without a second database

NonoDB now stores timestamped samples as compressed typed columns next to ordinary JSON documents. Here is what changes, what it costs, and where a dedicated time-series database is still the better tool.

Most applications do not start with a time-series database. They start with documents, then add metrics, sensor readings, or events. The usual answer is a second system: another server, another query language, another backup policy, and a pipeline to keep the two copies in sync.

NonoDB is a small document database. We added a timeseriescollection profile so that timestamped samples can live in the same process as the rest of the application. The goal is not to win every benchmark against a dedicated TSDB. The goal is to remove a second operational system for the common small and mid-size case.

One document per sample is expensive

A document per sample repeats the same field names on every row. That is convenient, but it is a poor physical layout for append-heavy data: timestamps, device ids, and status strings are stored again and again, and whole-row compression only goes so far.

On a 100k-row workload with 10 series and 8 columns, the same data takes about 41.59 MB as an ordinary document collection (436.1 bytes per row). The time-series profile stores a compacted copy in 1.02 MB(10.69 bytes per row). The uncompacted database is larger: LMDB keeps its high-water mark until you run a compacting copy, so the honest operational number is not always the smallest one.

FormSizeBytes / row
Raw JSON rows17.47 MB183.2
Standard collection, no indexes41.59 MB436.1
Time-series, sealed before compaction8.18 MB85.7
Time-series, compacted copy1.02 MB10.69

Buckets of typed columns

A time-series collection groups samples by series and by time window. The series is selected with a metaField; the event time with a timeField. Inside one bucket, metadata is stored once, and every other field becomes a typed column instead of a repeated JSON key.

The encoder tries several codecs per column and keeps the smallest result: delta and delta-of-delta for time, Gorilla XOR for floats, dictionary encoding for repeated strings, bit-packing for counters and booleans, and byte-shuffle plus zlib when the final stage actually helps. A column that never changes can cost a few bits per row.

Timestamps are part of the public contract. The time field accepts BSON dates, RFC 3339 strings, or epoch milliseconds. A missing or non-date value is rejected. Retention is relative to the event time, and changing the time or meta field moves the row to the correct bucket.

It still looks like a document database

Creating a time-series collection is a normal collection creation with two extra settings:

{
  "op": "create_collection",
  "coll": "readings",
  "profile": "timeseries",
  "timeseries": {
    "timeField": "ts",
    "metaField": "device",
    "granularity": "seconds",
    "compression": "balanced"
  }
}

Inserts, reads, aggregation, SQL, secondary and text indexes, TTL, watches, events, backups, and replication continue to use the same interfaces. A range query pins the series and time window and skips buckets outside the range instead of decoding every row. The bucket size is bounded by row count and encoded bytes, and open buckets stay uncompressed until they seal.

What it costs

Time-series collections are not free. On the same 100k-row workload, time-series inserts run at about 17.5k ops/s versus39.8k ops/s for ordinary documents. Point updates and deletes decode a bucket and are slower than a plain document update. Range reads are the intended access pattern: a one-hour, one-series read took 20.2 ms instead of 358 msfor the document baseline.

Where TimescaleDB still wins

A dedicated time-series database is still the right answer for many workloads. On the same 100k-row shape, TimescaleDB bulk-loads about98.9k rows/s versus 46k rows/s for NonoDB, and it is much faster on point updates, deletes, counts, and highly selective indexed queries. Its continuous aggregates and PostgreSQL ecosystem are real advantages.

NonoDB’s case is footprint and operational simplicity: one process, one backup, one auth model, and time-series data next to the documents already in the application. If you need very high ingest, all-series aggregation, or PostgreSQL extensions, use PostgreSQL and TimescaleDB.

The short version: use NonoDB time-series when you want one database for documents and telemetry on a small or mid-size deployment. Use a dedicated TSDB when ingest, query complexity, or ecosystem depth dominates.

Try it and check the numbers

The time-series docs cover creation, settings, aggregation, retention, indexes, compaction, and limitations. The benchmark page includes the workload, hardware, and reproduction commands, including the cases where TimescaleDB is faster.

This is a new surface, and feedback is welcome — especially from people who have run real telemetry workloads and know where the design breaks.