Enable users create Hierarchical Continuous Aggregates (aka Continuous
Aggregates on top of another Continuous Aggregates).
With this PR users can create levels of aggregation granularity in
Continuous Aggregates making the refresh process even faster.
A problem with this feature can be in upper levels we can end up with
the "average of averages". But to get the "real average" we can rely on
"stats_aggs" TimescaleDB Toolkit function that calculate and store the
partials that can be finalized with other toolkit functions like
"average" and "sum".
Closes#1400
When TimescaleDB 2.9.0 compiled against PG15, many tests fail due to
permissions on default public schema not getting propagated to data
nodes, although connected user has required GRANTS on access nodes.
This patch fixes failing tests by explicitly granting required permissions
for connected user or role after data nodes are added.
Don't include the used database ports into test output as this
will lead to failing tests when running against a local instance
or against a preconfigured cloud instance.
First step to remove the re-aggregation for Continuous Aggregates
is to remove the `chunk_id` from the materialization hypertable.
Also added new metadata column named `finalized` to `continuous_cagg`
catalog table in order to store information about the new following
finalized version of Continuous Aggregates that will not need the
partials anymore. This flag is important to maintain backward
compatibility with previous Continuous Aggregate implementation that
requires the `chunk_id` to refresh data properly.
This patch allows using custom origin's in CAGGs, for instance:
time_bucket_ng('7 days', day, '2000-01-03' :: date) AS bucket
For weekly buckets this allows the user to choose what should be considered
the beginning of the week - Sunday or Monday. Also by shifting the origin
one second forward or backward user can tweak the inclusiveness of the
buckets.
This works for date's, timestamp's and timestamptz's. The bucket size is
considered variable-sized in all these cases. CAGGs on top of distributed
hypertables, compressed hypertables and compressed distributed hypertables
are supported as well.
Additionally, this patch does several small refactorings. Firstly, it makes
sure that experimental features of CAGGs will be tested in both Debug and
Release builds. This was previously overlooked. Secondly, it renames the tests
so that a person who is working on experimental features in CAGGs will be able
to easily execute all the related tests: `TESTS='exp_cagg_*' make installcheck`
Last but not least the patch refactors is_valid_bucketing_function() and
renames it to function_allowed_in_cagg_definition(). The reason to do it in
this patch is that otherwise, the logic of the function gets rather confusing
which complicates code review.
fix