Database Model for Various Type of Sensors
-1
votes
2
answers
765
views
I am planning to build a database that will store sensor value for various type of sensors in a factory building. Is there any best practice on how to do this?
-
Option 1 : should I integrate all sensors into a single database like this
Table Sensor
---
SensorID
SensorType
SensorDesc
Table SensorReadings
---
SensorReadingID
SensorID
ReadingDateTime
ReadingValue
-
Option 2 : Or should I put each sensor type into separate table?
Table TemperatureSensor
---
SensorID
SensorDesc
Table TemperatureSensorReadings
---
SensorReadingID
SensorID
ReadingDateTime
ReadingValue (double)
Table MotionSensor
---
SensorID
SensorDesc
Table MotionSensorReadings
---
SensorReadingID
SensorID
ReadingDateTime
ReadingValue (integer)
Considering that various types of sensor tables will have similar fields but potentially different reading data types (some of them are integer and some of them are doubles, etc). Is it logical to separate the tables for each sensors? Or keep using a single table for every type of sensors?
- Which one is the best practice to implement such database if there might be various types of sensors to be added in the future?
- Which one can be better optimized for performance?
Thank you
Asked by Naruto
(7 rep)
Oct 22, 2019, 11:21 AM
Last activity: Jul 26, 2025, 09:04 AM
Last activity: Jul 26, 2025, 09:04 AM