Time series databases, what is it, and when to use it? published 11/15/2019 | 6 min read

Welcome everyone to a new devspedia story. Today we'll be talking about time series databases, what are they, and when it can be the best choice.

Car booking services


A common use cases for time series databases is with autonomous driving systems, ride booking apps, delivery apps, and last mile apps.

So, time series databases are used in many services and industries around us, some of these we interact with them day to day, here's a few examples:

  1. Autonomous trading algorithms, they keep track of market changes.
  2. Car booking apps, they need to keep track of driver and rider coordinates before, during, and after the trip to know where you want to be picked up, where you were actually picked up, where's the driver, where did he drop you off, ... etc.
  3. Last mile delivery companies tracking coordinates of their fleet of cars, to know their locations, and where packages were delivered, ...etc
  4. Cloud computing service providers such as AWS, Google Compute Cloud, Azure, ...etc they need to keep track of resources utilization, some of these require them to know changes happened to a resource as a time series.


So how does it work?

A time series database allows you to keep track of changes on a piece of data over time. This happens by combining some fixed and variable properties.

Let's take an example to make it clear; Let's say you've booked Uber from point A to point B. We need to keep track of your trip's path from start to end as a time series.

In a time series database, we can have this fixed property:

And this dynamic/variable property:

So since trip starts, and until trip is ended we keep sending new values (let's say every 100 meters) for the location property, while time is passing by.

At any point of time when we send a new value, this new record is called a tag. So now we have information

Now we have a tremendous amount of very useful data! Simply because it's reflecting 1 thing (a trip) and is tied with a time series. Here's what we can do with the above data.

  1. Know how much total time the trip consumed.
  2. Know the actual path the driver took during the ride.
  3. Know how much time the driver took in a particular street, and predict congestion in the future.
  4. Know average driver's car speed during entire trip, or between 2 particular coordinates.
  5. and a lot more!


Okay, sounds awesome, but I can do this with a regular DB (NoSQL, or kay-value pairs like Redis).

You're actually right! But there are a few differences between time series databases and other databases that makes it more valuable and efficient to use a time series database over a regular database for use cases as the mentioned above, here's a few below:

Scalability:

Usability:

Time series databases have built-in operations that are time-based, which does not exist in any other type of database, that makes it easier to run powerful analysis on these data.

Time series databases popularity is growing rapidly

For the past 2 years, time series databases are the fastest growing type of database in terms of usage and popularity.

DB Engines https://db-engines.com/en/ranking_categories

Finally, here's a list of top 20 ranking time series databases:

Time series databases are very useful when used in projects where time series is the only choice that makes sense.

Resources:

  1. https://blog.timescale.com/blog/what-the-heck-is-time-series-data-and-why-do-i-need-a-time-series-database-dcf3b1b18563/
  2. https://db-engines.com/en/ranking_categories
  3. https://www.influxdata.com/time-series-database/
  4. https://db-engines.com/en/ranking/time+series+dbms

Finally, thanks for reading devspedia, I love you, and see you the next time :)



You may also like reading: