TrailDB is an easy portable C library that allows you to query a series of relative events. It is used to group the existing relative events in a time-series format and produce an immutable database with high compression rate.
It is designed as a complement to current existing relational databases or key-value stores and targeted for OLAP workload such as analyzing usage patterns, predicting user behavior, and detecting anomalies. One key design feature is that the database is immutable once produced. This immutability feature allows the TrailDB to reach another key feature - data compression. It leverages relativity among time-series events to achieve high compression. These two key features allow TrailDB to achieve good performance in OLAP workload.
TrailDB system does not support the standard SQL query interface. It offers the query interface in several programming languages: C, Go, Python, R, Haskell, and D. TrailDB system also provides a query engine called trck, which is a domain specific language to aggregate metrics based on events of identical UUID.
Delta Encoding Run-Length Encoding Prefix Compression
First, within a trail, events are always sorted by time. Thus, it utilizes Delta Encoding to compress the 64-bit timestamps.
Second, since events are grouped by UUID, which usually represents a logical entity such as an online shopping customer, these events within a trail tend to be predictable and TrailDB only encodes every change in behavior. This is not exactly the same as the Run-Length Encoding but similar.
Third, Huffman Coding, which is a kind of Prefix Compression method, is used to encode the skewed, low-entropy distributions of values.
TrailDB adopts a specific relational data model.
Each database is a collection of trails.
Each trail is identified by a 128-bit user-defined ID and an automatically assigned trail ID. Each trail consists a sequence of events which is ordered by time.
Each event consists of a 64-bit timestamp and several user-pre-defined fields.
Each field contains a set of values.
TrailDB does not support logging and there's only one process to create the database. There is no recovery handler if the process crashes during the creation of the database. Thus, users need to start from the very beginning of the producing process.
But, TrailDB system allows merging existing TrailDBs to create a new immutable database. It is suggested to do so if there's a huge number of input events.
When creating a database, there's only one process to handle it and others cannot access it. Once the database is produced, it is a read-only immutable file. Thus, everyone can issue read requests to it, but cannot issue any write operations. In this view, it is equivalent to the serializable isolation level.
https://github.com/traildb/traildb
AdRoll Inc.
2014