Managing Data Lifecycles in Clickhouse

TLDR Alejandro needed help with data management in Clickhouse. Srikanth and vishal-signoz provided links and examples for implementing tag level TTL and data deletion.

Photo of Alejandro
Alejandro
Thu, 11 May 2023 20:36:15 UTC

Looks I have not space at clickhouse: ```Cannot reserve 1.00 MiB, not enough space``` how can i drop my data from clickhouse since x days?

Photo of Srikanth
Srikanth
Fri, 12 May 2023 02:15:52 UTC

See

Photo of Alejandro
Alejandro
Fri, 12 May 2023 11:28:18 UTC

Ahaa ok. I thought I have an option via SigNoz UI to clean data from determined date

Photo of Alejandro
Alejandro
Fri, 12 May 2023 11:29:48 UTC

On the other hand, is a way to say for example application with tag service name helloworld keep traces from last 15 days ?

Photo of Srikanth
Srikanth
Fri, 12 May 2023 15:35:53 UTC

Yes, there is some form of tag level TTL, but there is no way to do it from UI.

Photo of Alejandro
Alejandro
Sun, 14 May 2023 17:06:38 UTC

How can I do it ? Without the UI ?

Photo of Srikanth
Srikanth
Mon, 15 May 2023 04:49:08 UTC

through clickhouse command line

Photo of Alejandro
Alejandro
Mon, 15 May 2023 14:06:58 UTC

can you share that command ?

Photo of Srikanth
Srikanth
Mon, 15 May 2023 14:29:36 UTC

I know it exists but haven’t tried it ourselves.

Photo of vishal-signoz
vishal-signoz
Mon, 15 May 2023 14:36:13 UTC

Here’s an example Alejandro for the your case ```CREATE TABLE events ( `event` String, `time` DateTime, `value` UInt64 ) ENGINE = MergeTree ORDER BY (event, time) TTL time + INTERVAL 1 MONTH DELETE WHERE event != 'error', time + INTERVAL 6 MONTH DELETE WHERE event = 'error'```

Photo of vishal-signoz
vishal-signoz
Mon, 15 May 2023 14:36:40 UTC

Refer:

Photo of vishal-signoz
vishal-signoz
Mon, 15 May 2023 14:37:39 UTC

Follow this: