First of, ‘huh, completely missed there was such a category’.
Second of, ‘huh, only 4 topics. Need to fix that’.
I am building (and learning how it goes down in a long run) a small app, which is aimed to process and host data from smart sensors (so far I didn’t find anything that I would find interesting except humidity and temp). I wonder if I can find wind speed and light level sensors, usable for an apartment.
This app is a source for other apps to ge current data by sensor(microservice architecture).
But I am also storing this data for future uses (before a HnT data, displayed on a small e-ink screen, sitting right next to my monitor, I didn’t even know for which levels of humidity to take an umbrella when going outside).
So I’m collecting this data, and plan to use it once I get an inspiration(and a right idea). Meaning that I will be reading data in scope of dates, and specific time periods.
I started off with Mongo, collecting data by sensor per day, keeping a separate db entry in memory and flushing it to db once an hour. It did work, although I somehow screwed up somewhere, and after day 3 was getting an NPE. But I didn’t touch that project for a while, and when I finally did, I looked again at the whole question, and moved to Postgres (I feel more at home with sql and ‘everything on its shelf’ structure approach).
Everything looks neat and tidy, but I do feel that ‘long’ isn’t eternal (althooough 9,223,372,036,854,775,807 is quite a big number), and should do fine for a single table, which currently has 2 new records once a minute (and 2 more, but those seem to be once an hour or something). But in time, the number of temp sensors will increase, and so will the record count. I do realize that I can group the data and write an average of 5 minutes. Or even make maintenance jobs, which will archive outdated data, clearing the table (I find this as an interesting future experience).
But I am basically thinking of two things:
- Was the mongo a better approach? I know that reading a full month of data would be bringing up all that data from db into app.
- SQL (I like sql) although sounds better (easier to write, and seems to be easier to read with the right sql query). But I haven’t seen how a sql table behaves with this much data.
Also was thinking of going a mongo like approach, and simply write data to regular files (in csv format or something).
Your thoughts?
P.S. I know HomeAssistant exists. I have it on my list of stuff to research. But I do love bringing up things from the ground, and experiencing good and bad decisions.
