Sensor data from generators


I have 3 sensors getting active power readings from 3 generators every second. I am currently using 3 tables, one for each sensor, to store the active power readings. My intention is to be able to display the power production from each generator and also to be able to sum the production from all the generators ever second.

I have two questions:

  1. how can i calculate the sum of the readings considering that the values are in different tables
  2. i intend to expand the system to about 40 generators, is this approach the best or there is a better way of doing this?


I think we’d recommend that you store the values in a single hypertable with a column, maybe generator_id that identifies the generator that each reading is associated with. That will make this calculation easier and makes it much easier to expand. You should also create an index on the hypertable on generator_id, time DESC like CREATE INDEX on ht_name(generator_id, time DESC) . That index will make a lot of queries significantly faster!

Thank you for your response.