What’s New RavenDB 5.0

RavenDB 5.0 comes with Distributed Time Series support, Documents Compression, and enhanced indexing: you can now index Distributed Counters’ values, and your indexes can now use Compare-Exchange Keys.

Document database

Distributed Time Series

You can improve the usability and ease the management of numerous processes by handling their data using Time Series – vectors of data-points whose values are ordered by time. The measurements sent by an air-quality sensor, for example, can be easily evaluated over time using Time Series and used to suggest various improvements; the accumulating oxygen saturation levels measured by a hospital monitor can help verify recovery processes and treatment efficiency; and so on for countless processes and applications.

We’ve integrated Time Series functionality into RavenDB 5.0’s document model, distributed environment, and various other features. Time Series always extend specific documents, to keep their context clear and their operation simple. Their data, however, is kept separately from that of the documents they extend, so they may be rapidly modified without invoking document changes. Distributed clients and nodes can modify Time Series concurrently and the modifications are merged by the cluster with no conflict.

Here are some additional RavenDB 5.0 Time Series features.

  • Highly-efficient storage management
  • A thorough set of API methods
  • Full GUI Time Series management
  • Time Series transactional guarantee
  • Time Series querying and aggregation gives speedy results on massive datasets
  • Time Series indexing using LINQ functions
  • Rollup policies, to aggregate large series into smaller sets by your definitions
  • Retention policies, to automatically remove redundant data
  • Including (pre-fetching) Time Series data to make it available in a client’s cache

Documents Compression

The schema-less nature of document databases has many benefits, but a key flaw: It requires us to manage the structure of data on a per-document basis. In some cases, the majority of the data you keep is actually the document’s structure.
RavenDB 5.0 now addresses this issue and offers a great solution in its Documents Compression feature.

Document compression uses top of the line Zstd compression algorithm to learn your data model and create dictionaries that represent repeated data across documents. This includes the repeated document structure, but also the document data itself.

RavenDB continuously inspects your documents to create the best compression model. As your data changes, RavenDB adjusts its models to reduce the amount of disk space you require. In most datasets, the space savings we see are greater than 50%.

The abundance of rarely-used documents that tend to accumulate while the database grows, is another good reason for document compression: compressing them would free storage space, while little to no resources would ever be spent on decompressing the documents for reading.

  • We compress collections rather than documents, to eliminate cross-document duplications.
  • We use the zstd compression algorithm. The algorithm is trained by each compression operation and continuously improves its compression ratio.
  • Reading and querying compressed large datasets is usually at least as fast as reading and querying their uncompressed versions because the compressed data is loaded much faster.
  • Compressed documents usually occupy about half, and sometimes much less, of their original data size.
  • Compression and decompression is transparent to the user, you get the benefit of less space usage, without any worries.

Indexing Enhancements

RavenDB 5.0 lets you create static indexes for Time Series and distributed counters, and use compare-exchange values in your indexes.

Static indexing for Distributed Counters values

Distributed counters are numerical data variables that can be added to documents and provide them with high-performance counting capabilities. An added counter can count, for example, the number of downloads from a web page, or the number of cars passing a road camera. Counters can be accessed for reading or writing by multiple clients and cluster nodes, can be managed via API methods and the Studio, and are supported by a variety of RavenDB features including, to name just a few, queries, data subscriptions, backup, and many others. Now, counters can also be indexed.

  • You can create Map and Multi-Map counter indexes.
  • You can create counter Map-Reduce indexes to aggregate your results.
  • Counters can be indexed using LINQ functions.
  • You can index all counters of a document or a collection, or just a specific counter.


Using Compare-Exchange Keys from an index

RavenDB’s compare-exchange feature introduces interlocked operations to your distributed environment. You can use compare-exchange operations to reserve unique keys in the database group and guarantee cluster-wide atomicity while modifying a key’s state.

Read more about compare exchange.

Starting from RavenDB 5.0, indexes can load compare-exchange keys and react to changes in their state.


  • Take a look at a complete RavenDB 5.0 changelog here.