Giter VIP home page Giter VIP logo

tsdb's Introduction

time-series database

Features:

  • ACID compliant
  • high performance
  • multi-threaded
  • query cache
  • B-Tree index
  • sorted array index (bin-search)
  • one scalar per data-point
  • aggregate functions
  • WHERE on timestamp
  • WHERE on value
  • GROUP BY support on timestamp
  • textual command interface
  • binary command interface
  • multiple scalars (tuples) per data-point
  • old data downsampling
  • old data deletion
  • auth: name & password
  • ssl / tls

ACID

Data structure

Data points are organized into individual Series. These series are independent of each other and can have different data-values with different timestamps. Each Series has a name and data schema associated with it.

Schema of the Series dictates how are the data points encoded on the disk.

Data points in one Series are split into multiple Blocks. Each block has a size of 4096 bytes. These block form a log-structured merge-tree. Multiple blocks (2048) are stored in one file. During the application execution some blocks are loaded in memory (cached). All blocks are stored on disk.

The database also stores Index which is used to speed up queries on the data. Index object stores lowest and highest timestamp for each block. There is one Index for each Series object. Also the index is stored in one file and it is loaded in memory at all times.

Schemas

Currently these schemas are supported: f32.

Planned schemas: f32, i32, f64, i64, bool.

f32
  • Timestamp encoding: delta-encoded LEB128 varints
  • Value encoding: low-endian without any compression
i32
  • Timestamp encoding: delta-encoded LEB128 varints
  • Value encoding: delta-encoded LEB128 varints
bool
  • Timestamp encoding: delta-encoded LEB128 varints
  • Value encoding: One boolean takes one bit.

Operations on the data

Database provides following operations on the data.

Create series

Creates a new Series object in the database.

CREATE SERIES {series} {schema}
CREATE SERIES outdoor_sunlight f32
{
  "CreateSeries": "default"
}

List series

Returns a list of all available series inside the database.

SHOW SERIES

Insert value

Inserts a specified value to the specified time Series object.

INSERT INTO {series} {value}
INSERT INTO outdoor_sunlight 4806.0
{
  "Insert": {
    "to": "default",
    "value": 3.14
  }
}

Query values

Gets all data points inside the specified Series object in specified range of time.

SELECT {series} BETWEEN {start_timestamp} AND {end_timestamp}
SELECT outdoor_sunlight BETWEEN 01-01-2019 AND 02-01-2019
{
  "Select": {
    "from": "default",
    "between": {
      "min": null,
      "max": null
    }
  }
}

It is also possible to query result of running an aggregate function on specified range data points in the specified Series object.

SELECT [AVG/SUM/MAX/MIN/COUNT] {series} BETWEEN {start_timestamp} AND {end_timestamp} GROUP BY [MINUTE/HOUR/DAY/WEEK/MONTH]
SELECT AVG outdoor_sunlight BETWEEN 01-01-2019 AND 02-01-2019 GROUP BY HOUR

tsdb's People

Contributors

dependabot-preview[bot] avatar dobrakmato avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.