I'll design and implement database for data acquisition and started to wonder what might be the best relational database structure for multivariable solution. There can be dozens of variables (configurable), different types (boolean, integer, float at least, maybe string). Values of different variables are not related. I need to store variable, new value and timestamp. Storing variables is triggered either by a clock or change of value.
Simplest solution would be one table with variable FK, new value, and timestamp, but since variables can have different types, type of new value causes problem. I can think few possible solutions, all involving separate table for variable definition and one or more table for timeseries, one record for each variable-value-timestamp:
- Have some common data type which can store all values (string?)
- Have multiple columns, one for each type
- Have multiple tables for data values, one table for each type
Something else?
Basically I'm looking for good "database design pattern".