我有这个连续的观点:
=# CREATE CONTINUOUS VIEW v AS
SELECT id::int, count(v::int) AS counter, avg(v) AS average
FROM mystream
GROUP BY id;
所以我需要平均值,以及用于计算该平均值的元素数量(counter
)。有没有办法从 AVG 数据结构中提取这个计数,所以我不必创建一个counter
字段?
=# TABLE v_mrel0;
id | counter | average
----+---------+---------
1 | 2 | {2,30}