> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify-poc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# remove_policies()

> Remove refresh, compression, or data retention policies from a continuous aggregate

export const COLUMNSTORE = 'columnstore';

export const HYPERTABLE = 'hypertable';

export const CAGG = 'continuous aggregate';

<Icon icon="flask" /> Early access <Icon icon="tag" iconType="duotone" /> Since [2.10.0][tsdb-2.10.0]

Remove refresh, {COLUMNSTORE}, and data retention policies from a {CAGG}. The removed {COLUMNSTORE} and retention
policies apply to the
{CAGG}, *not* to the original {HYPERTABLE}.

```sql theme={"dark"}
timescaledb_experimental.remove_policies(
     relation REGCLASS,
     if_exists BOOL = false,
     VARIADIC policy_names TEXT[] = NULL
) RETURNS BOOL
```

To remove all policies on a {CAGG}, see
[`remove_all_policies()`][remove-all-policies].

## Samples

Given a {CAGG} 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 {CAGG} has a
{COLUMNSTORE} policy, leave it unchanged:

```sql theme={"dark"}
SELECT timescaledb_experimental.remove_policies(
    'example_continuous_aggregate',
    false,
    'policy_refresh_continuous_aggregate',
    'policy_retention'
);
```

## Arguments

The syntax is:

```sql theme={"dark"}
SELECT timescaledb_experimental.remove_policies(
    relation = '<view_name>',
    if_exists = true | false,
    policy_names = '<policy_name>', ...
);
```

| Name           | Type       | Default | Required | Description                                                                                                                                                                                 |
| -------------- | ---------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `relation`     | `REGCLASS` | -       | ✔        | The {CAGG} to remove policies from                                                                                                                                                          |
| `if_exists`    | `BOOL`     | false   | -        | When true, prints a warning instead of erroring if the policy doesn't exist.                                                                                                                |
| `policy_names` | `TEXT`     | -       | -        | The 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.

[remove-all-policies]: /api-reference/timescaledb/continuous-aggregates/remove_all_policies

[tsdb-2.10.0]: https://github.com/timescale/timescaledb/releases/tag/2.10.0
