DELETE + WHERE in TTL

ClickHouse actually supports only `DELETE` action with `WHERE` clause of a `TTL` statement
This commit is contained in:
Denys Golotiuk 2023-01-24 17:50:29 +02:00 committed by GitHub
parent 689fbea759
commit c1de756d8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -611,7 +611,10 @@ Type of TTL rule may follow each TTL expression. It affects an action which is t
- `TO VOLUME 'bbb'` - move part to the disk `bbb`;
- `GROUP BY` - aggregate expired rows.
With `WHERE` clause you may specify which of the expired rows to delete or aggregate (it cannot be applied to moves or recompression).
`DELETE` action can be used together with `WHERE` clause to delete only some of the expired rows based on a filtering condition:
``` sql
TTL time_column + INTERVAL 1 MONTH DELETE WHERE column = 'value'
```
`GROUP BY` expression must be a prefix of the table primary key.