Correct Multi Tenant Structure

I have a question regarding the correct setup for a multi tenant IOT sensor application. Basically, I have a customer id with each customer having 1 to potentially thousands of sensors deployed each with a sensor id. The sensors each generate many records each day. So any thoughts on which of the setups below would be optimal. There are very few queries that extend across multiple customers and they do not have to be particularly performant. There are many queries that extend across multiple sensors and they do need a high level or performance.

Simple

  • Single database
  • Sensor measurement with customerId, and sensorId as tags

More Segmented

  • Single database
  • Each customer gets its own measurement containing data from all customer sensors with sensorId as a tag
  • Use regex to request data across multiple measurements

Even More Segmented

  • Single database
  • Each customer and each sensor gets it’s own measurement
  • Use regex to request data across multiple measurements

Multi Database

  • Each customer gets their own database
  • Single measurement for all sensorIds with sensorId as a tag
  • Merge query results from multiple databases for the infrequent cross customer queries

Multi Database Segmented

  • Each customer gets their own database
  • Each sensorId gets its own measurement
  • Use regex to select from multiple sensor measurements
  • Merge query results from multiple databases for the infrequent cross customer queries
1 Like