We have a monitoring app that will upload data to the server and we store it in a hypertable. But the upload rate may vary, e.g.
- first the customer may upload data every 10 minutes for 1 month
- then the app my be down for 2 weeks
- then the customer may start the app and upload samples every 10 milliseconds for a day
- then change the rate back to 10 minutes for the next 2 weeks, etc.
So the insert rates can be changed arbitrarily by the customer.
I didn't find something in the docs related to such a use case. Here is what I found related to the chunk time interval:
- When we create a hypertable we can specify the
- And we can change the interval for new chunks via set_chunk_time_interval()
So: does timescaledb already support varying insert rates - or is such a feature planned?
If not, is there a good workaround? E.g. I think that something like this may work:
- We could have a "normal" staging table where we insert the data and gather some statistics.
- When the staging table reaches a threshold of rows (e.g. 2million), we create a hypertable where we set the chunk size to cover the current data in the staging table and then move the rows from the staging table to the hypertable
- When the staging table reaches the threshold again, we set_chunk_time_interval() so that it covers the range of the 2 million rows, then move those rows to the hypertable, and so on
We would also create a view in the database that makes a
UNION over the staging table and the hypertable.