The syntax is:
Note that continuous aggregates have some limitations of what types of queries they can support, described in more length below. For example, the FROM
clause must provide only one hypertable, i.e., no joins, CTEs, views or subqueries are supported. The GROUP BY
clause must include a time bucket on the hypertable’s time column, and all aggregates must be parallelizable.
Parameters
Required WITH
clause options
Optional WITH
clause options
Notes
- The view will be automatically refreshed (as outlined under ) unless
WITH NO DATA
is given (WITH DATA
is the default). - The
SELECT
query should be of the form specified in the syntax above, which is discussed in the following items. - Only a single hypertable can be specified in the
FROM
clause of the query. This means that including more hypertables, joins, tables, views, subqueries is not supported. - The hypertable used in the
SELECT
may not have row-level-security policies enabled. - is not allowed in continuous aggs, but may be run in a
SELECT
from the continuous aggregate view. - In general, aggregates which can be parallelized by PostgreSQL are allowed in the view definition, this includes most aggregates distributed with PostgreSQL. Aggregates with
ORDER BY
,DISTINCT
andFILTER
clauses are not permitted. - All functions and their arguments included in
SELECT
,GROUP BY
andHAVING
clauses must be . - The view is not allowed to be a security barrier view.
Sample Usage
Create a continuous aggregate view.