add_policies() does not allow the schedule_interval for the to be set, instead using a default value of 1
hour.If you would like to set this add your policies manually (see
add_continuous_aggregate_policy).Samples
Given a namedexample_continuous_aggregate, add three
policies to it:
- Regularly refresh the to materialize data between 1 day and 2 days old.
- Compress data in the after 20 days.
- Drop data in the after 1 year.
Arguments
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
relation | REGCLASS | - | ✔ | The that the policies should be applied to |
if_not_exists | BOOL | false | - | When true, prints a warning instead of erroring if the doesn’t exist. |
refresh_start_offset | INTERVAL or INTEGER | - | - | The start of the refresh window, expressed as an offset from the policy run time. |
refresh_end_offset | INTERVAL or INTEGER | - | - | The end of the refresh window, expressed as an offset from the policy run time. Must be greater than refresh_start_offset. |
compress_after | INTERVAL or INTEGER | - | - | s are compressed if they exclusively contain data older than this interval. |
drop_after | INTERVAL or INTEGER | - | - | s are dropped if they exclusively contain data older than this interval. |
INTERVAL or an INTEGER, use an
INTERVAL if your time bucket is based on timestamps. Use an INTEGER if your
time bucket is based on integers.
Returns
Returnstrue if successful.