TimescaleDB's continous aggregates and materialized views are very limited. One could think that just replacing time_bucket
with time_bucket_gapfill
would be enough to enable gap filling in a materialized view. But it is simply not allowed in the context of a materialized view. Then one could think that sticking with time_bucket
and simply implementing the gap-filling logic yourself is enough, but CTEs are not allowed in timescale materialized views. So the next logic though would be to use subqueries instead, but also those are not allowed. The only option is to completely ditch the timescaledb.continuous
. This will have a few downside, but mainly for very large views, which might not be the case for a lot of use cases, so for those this is an option.
Lets create an example setup with multiple stations having some data each.