Back

Storing sensor data in DB

  • 0
  • Databases
Pappapa
8 Jan, 2024, 21:59

I have a solar monitor device that emits 10 parameters per minute, in Json format. What is the right way to store the data in DB:

  • shall all minute entry be a separate document,
  • or to keep all data from one device in one document,
  • or to have multiple time-limited (daily, monthly) documents for one device?
  • shall have separate collection for each device? What is a reasonable number of collections and documents to deal with?
TL;DR
The user wants to know the best way to store sensor data in a database. They have a solar monitor device that emits 10 parameters per minute in JSON format. They are asking whether each minute's data should be a separate document or if all data from one device should be in one document. They also want to know if they should have time-limited documents or separate collections for each device. They are also seeking guidance on the reasonable number of collections and documents to handle.
Drake
10 Jan, 2024, 02:19

Single vs multiple documents per data point is up to you depending on how you'll be using the data.

I typically create a collection per data type and void having multiple collections with the same schema

Drake
10 Jan, 2024, 02:22

A collection should be able to handle billions of documents. Under the hood, a collection is a mariadb table so refer to the limitations there: https://stackoverflow.com/questions/56474252/max-number-of-records-can-mariadb-support

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more