Quantcast
Channel: TimescaleDB and PostgreSQL - Timescale Community Forum
Viewing all articles
Browse latest Browse all 291

Simple dynamic continuous aggregates

$
0
0

Hi. We’re experimenting with Timescale, and I have a specific question about continuous aggregates. We’re gathering data from many different devices each with its own unique parameters.

We’re planning on using a narrow schema basically

| timestamp | device_id | parameter_id | value |

and only partition the data into separate hypertables roughly based on device category and maybe data type.

We think we could cover most of our analytics needs using continuous aggregates. Each parameter might require a different aggregation function, max vs average for example.
The aggregations then need to be stacked to get even lower resolution views (hourly → daily).

One idea could be to store the aggregation function with the parameter metadata and choose the right aggregate with the help of a JOIN and CASE, or to create a separate aggregate and hence hypertable for each aggregation and use a single filter in a WHERE with the joined metadata.

Actually now that I read about the two step aggregations. Another idea would be to just implement the first step with one or two aggregate functions regardless of the parameter, build a hierarchy using rollup and query the right metric using accessors on the fly. I’m strongly leaning towards this solution. It doesn’t try to be smart about the specific aggregates, but using some extra space greatly simplifies the management of the aggregates.

Are there any other ways we could dynamically encode the aggregation function, or even a completely different approach altogether?

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 291

Trending Articles