remove_policies()

Remove refresh, compression, and data retention policies from a continuous aggregate. The removed compression and retention policies apply to the continuous aggregate, not to the original hypertable.

  1. timescaledb_experimental.remove_policies(
  2. relation REGCLASS,
  3. if_exists BOOL = false,
  4. VARIADIC policy_names TEXT[] = NULL
  5. ) RETURNS BOOL

To remove all policies on a continuous aggregate, see remove_all_policies().

warning

Experimental features could have bugs. They might not be backwards compatible, and could be removed in future releases. Use these features at your own risk, and do not use any experimental features in production.

Required arguments

NameTypeDescription
relationREGCLASSThe continuous aggregate to remove policies from

Optional arguments

NameTypeDescription
if_existsBOOLWhen true, prints a warning instead of erroring if the policy doesn’t exist. Defaults to false.
policy_namesTEXTThe policies to remove. You can list multiple policies, separated by a comma. Allowed policy names are policy_refresh_continuous_aggregate, policy_compression, and policy_retention.

Returns

Returns true if successful.

Sample usage

Given a continuous aggregate named example_continuous_aggregate with a refresh policy and a data retention policy, remove both policies.

Throw an error if either policy doesn’t exist. If the continuous aggregate has a compression policy, leave it unchanged:

  1. SELECT timescaledb_experimental.remove_policies(
  2. 'example_continuous_aggregate',
  3. false,
  4. 'policy_refresh_continuous_aggregate',
  5. 'policy_retention'
  6. );