I have a question regarding the design of an application where the database system has a rollover. To clarify the context :
- the database system (a cloudant instance) is fed with sensor data by an iot platform
- the iot platform performs a database rollover each day, week or month (configurable but fixed once it's configured)
- at the beginning of month x, the database x+1 is created with some indexes.
So the sensor data from month x of year y will go in the cloudant database mydb-<y>-<x>
.
Disregarding the fact that this is a painful way to do things, I have to create an application that will have to query data from database x, x-1 and eventually x-2.
My question is is there any 'correct' way to do this ? Are there any known patterns or gotchas to be aware of that would allow me to proceed in this direction or should I look into other solutions, like replicating the data from the databases x to x-n into one aggregating db to simplify things ? It will make me lose the benefit of having more lightweight databases in the end but it would be more simple.