2

I need to implement a system for storing timestamped sensor data from several devices on an embedded platform. According to this related question, a relational database is the preferred solution for storing that kind of data and I have therefore been looking at SQLLite.

However, I also need the database to be able to answer questions such as "What was the indoor temperature on Sep 12 at 13:15", even if the sensor data was not recorded precisely at that time. In other words, I need the database to be able to handle interpolation. As far as I could tell, SQLite cannot handle this, nor can the usual suspects (MySQL, PostgreSQL).

In addition, I would also need the database to be able to detect gaps in the data.

This related question seems to deal with mainframe-ish databases and not with embedded ones.

Therefore: Is there a database system suitable for embedded platforms that supports the "usual" operations one might want to perform on time-series data?

Community
  • 1
  • 1
lindelof
  • 34,556
  • 31
  • 99
  • 140

2 Answers2

1

You shouldn't want or expect a database to do interpolation for you. Just pull out the nearest values to your desired time, and write your own interpolation. Only you would know what the appropriate type of interpolation should be used. Maybe simple linear across two points, maybe higher order polynomial across more points. It really depends on your system and data modeling situation.

TJD
  • 11,800
  • 1
  • 26
  • 34
  • Actually, Time series databases are designed to solve this kind of things for you (non-relational databases). This answer is more akin to seeing every tool as a hammer, when what you really want is a specialized tool for a specific task. http://opentsdb.net/query-execution.html#aggregation What would be interesting to know is if there are any "SQLLite"-like time series databases, most implementations seem to build on large scale systems such as hadoop, mongodb and cassandra. – Joakim May 20 '13 at 15:17
  • Here's an interesting memo about time series databases: http://www.xaprb.com/blog/2014/03/02/time-series-databases-influxdb/ – buzz3791 Feb 03 '15 at 16:25
1

Specialized time series databases.

Try:

  • RRDTool (simple utility, may be sufficient for you)
  • OpenTSDB
  • InfluxDB

Given your use case, may also be relevant to take a totally different approach, using an "IoT" targeted data store optimized for simple inserts (Xively, Phant.io) and then post-process for time series analysis.