pg_prometheus icon indicating copy to clipboard operation
pg_prometheus copied to clipboard

Continuous aggregates creation not supported by the normalized storage

Open ivansenic opened this issue 5 years ago • 1 comments

I am not 100% sure that what I will write is completely true, but we are using the pg_prometheus with normalized storage for some time now. Today we wanted to create some basic continuous aggregates view so that our dashboards are more responsive when looking to the long-term data.

Unfortunately we constantly fail to do so. Even the most simply aggregate like:

prometheus=# CREATE VIEW basic
prometheus-# WITH (timescaledb.continuous)
prometheus-# AS
prometheus-# SELECT
prometheus-# time_bucket('1 day', time),
prometheus-# sum(value) AS "total"
prometheus-# FROM metrics
prometheus-# GROUP BY time_bucket('1 day', time);
ERROR:  invalid SELECT query for continuous aggregate

fails with the invalid select query error message. The select query itself works without any problem of course.

As I understand this, the creation most likely fails as the metric is not a table, but a view. If this is the case, how can we perform continuous aggregates with the normalized storage? Would I need to go directly to the metrics_labels and metrics_values tables?

Any suggestions would be great here.

ivansenic avatar Dec 05 '19 13:12 ivansenic

Continues aggregate expects single hypertable in the from clause. Views, joins, subqueries are not supported. See the docs

k-rus avatar Dec 05 '19 13:12 k-rus