# ALTER QUERY POLICY
`ALTER QUERY POLICY` changes the mode, rules, or owner of a query policy.

> For the complete documentation index, see [llms.txt](https://materialize.com/docs/llms.txt).




`ALTER QUERY POLICY` changes the mode, rules, or owner of a [query
policy](https://materialize.com/docs/markdown-docs/clusters/query-policies/index.md). Changes apply to queries admitted after
the change, on every cluster the policy is attached to. Queries that are
already running are not affected.

## Syntax


**Set mode or rules:**



```mzsql
ALTER QUERY POLICY <name> SET (
  [MODE = '<mode>']
  [, RULES (
    <rule_name> (action = 'reject', metric = 'query_plan_includes', value = '<plan_feature>')
    [, ...]
  )]
)
;

```

| Syntax element | Description |
| --- | --- |
| `<name>` | The name of the query policy to modify.  |
| `MODE` | *Optional.* `'warn'` or `'enforce'`. See [`CREATE QUERY POLICY`](https://materialize.com/docs/markdown-docs/sql/create-query-policy/index.md#syntax).  |
| `RULES` | *Optional.* The new set of rules. Replaces all existing rules in the policy. Specify `RULES ()` to remove all rules.  |
| `<rule_name>` | The name for the rule. Must be unique within the query policy.  |
| `<plan_feature>` | `'temporary_dataflow'` or `'storage_read'`. See [`CREATE QUERY POLICY`](https://materialize.com/docs/markdown-docs/sql/create-query-policy/index.md#syntax).  |



**Change owner:**



```mzsql
ALTER QUERY POLICY <name> OWNER TO <new_owner_role>;

```

| Syntax element | Description |
| --- | --- |
| `<name>` | The name of the query policy.  |
| `<new_owner_role>` | The role to own the query policy.  |





## Privileges

The privileges required to execute this statement are:

- Ownership of the query policy.

To change the owner, you must also be a member of the new owner role.

## Examples

Switch a policy from `warn` to `enforce`:

```mzsql
ALTER QUERY POLICY indexed_reads_only SET (MODE = 'enforce');
```

Replace a policy's rules:

```mzsql
ALTER QUERY POLICY indexed_reads_only SET (
  RULES (
    no_storage_reads (action = 'reject', metric = 'query_plan_includes', value = 'storage_read')
  )
);
```

## Related pages

- [Query policies](https://materialize.com/docs/markdown-docs/clusters/query-policies/index.md)
- [`CREATE QUERY POLICY`](https://materialize.com/docs/markdown-docs/sql/create-query-policy/index.md)
- [`DROP QUERY POLICY`](https://materialize.com/docs/markdown-docs/sql/drop-query-policy/index.md)
- [`SHOW QUERY POLICIES`](https://materialize.com/docs/markdown-docs/sql/show-query-policies/index.md)
