我有这张series
桌子和它的超表。我想对该表中的数据进行不同的连续聚合。
CREATE TABLE series (
time TIMESTAMPTZ PRIMARY KEY,
value INTEGER
);
SELECT create_hypertable('series', 'time');
CREATE VIEW mat_view1
WITH (timescaledb.continuous) AS
SELECT time_bucket('1 day', time) AS day,
AVG(value)
FROM series
GROUP BY day;
CREATE VIEW mat_view2
WITH (timescaledb.continuous) AS
SELECT time_bucket('1 week', time) AS week,
COUNT(value)
FROM series
GROUP BY week;
但在PostgreSQL 11中似乎是不可能的——这是我在运行上面的查询时得到的:
ERROR: hypertable already has a continuous aggregate
RECOMMENDATION: hypertables currently only support a single continuous aggregate. Drop the other continuous aggreagate to add a new one.
甚至不可能在同一张表上创建不同的超表。
ERROR: hypertable already has a continuous aggregate
RECOMMENDATION: hypertables currently only support a single continuous aggregate. Drop the other continuous aggreagate to add a new one.
是否可以解决此限制?series
或者我应该使用另一种方法(例如,每个连续聚合的重复表:-x)?