Cleaning Up Signoz Clickhouse Data without Reinstalling

TLDR Muhammed wanted to clean up signoz clickhouse data without losing settings. Srikanth provided a list of queries for truncating tables. Issue was resolved after truncating the 'logs' table.

Photo of Muhammed
Muhammed
Mon, 06 Mar 2023 08:45:14 UTC

How can I clean up signoz clickhouse and start over without removing and installing chart again? I don't want to loss settings

Photo of Muhammed
Muhammed
Mon, 06 Mar 2023 09:05:17 UTC

Srikanth

Photo of Srikanth
Srikanth
Mon, 06 Mar 2023 09:08:01 UTC

Do you want to truncate the tables? That would just remove the existing data, but the schemas etc. will all be there.

Photo of Muhammed
Muhammed
Mon, 06 Mar 2023 09:08:41 UTC

I only want to trucate existing log, traces and metrics

Photo of Muhammed
Muhammed
Mon, 06 Mar 2023 09:10:31 UTC

Srikanth there are docs on how to do that, or can you help me with the queries to run on database shards?

Photo of Srikanth
Srikanth
Mon, 06 Mar 2023 10:20:01 UTC

```TRUNCATE TABLE IF EXISTS signoz_logs.distributed_logs ON CLUSTER cluster; TRUNCATE TABLE IF EXISTS signoz_traces.distributed_signoz_index_v2 ON CLUSTER cluster; TRUNCATE TABLE IF EXISTS signoz_traces.distributed_signoz_spans ON CLUSTER cluster; TRUNCATE TABLE IF EXISTS signoz_traces.distributed_signoz_error_index_v2 ON CLUSTER cluster; TRUNCATE TABLE IF EXISTS signoz_traces.distributed_durationSort ON CLUSTER cluster; TRUNCATE TABLE IF EXISTS signoz_traces.distributed_top_level_operations ON CLUSTER cluster; TRUNCATE TABLE IF EXISTS signoz_traces.distributed_dependency_graph_minutes ON CLUSTER cluster; TRUNCATE TABLE IF EXISTS signoz_traces.distributed_usage ON CLUSTER cluster; TRUNCATE TABLE IF EXISTS signoz_traces.distributed_usage_explorer ON CLUSTER cluster; TRUNCATE TABLE IF EXISTS signoz_metrics.distributed_samples_v2 ON CLUSTER cluster; TRUNCATE TABLE IF EXISTS signoz_metrics.distributed_time_series_v2 ON CLUSTER cluster; TRUNCATE TABLE IF EXISTS signoz_metrics.distributed_usage ON CLUSTER cluster;```

Photo of Muhammed
Muhammed
Mon, 06 Mar 2023 11:40:33 UTC

Srikanth I ran queries but nothing changed

Photo of Muhammed
Muhammed
Tue, 07 Mar 2023 07:02:23 UTC

Srikanth Can you help me with that?

Photo of Srikanth
Srikanth
Tue, 07 Mar 2023 07:06:15 UTC

That’s surprising, can you run the queries in shard with `distributed_` in the truncate query?

Photo of Muhammed
Muhammed
Tue, 07 Mar 2023 07:10:10 UTC

I ran all of the queries in all of the shards

Photo of Srikanth
Srikanth
Tue, 07 Mar 2023 09:28:34 UTC

I don’t know what the reason could be. I will have to search.

Photo of Muhammed
Muhammed
Tue, 07 Mar 2023 09:29:00 UTC

fixed by truncating `logs` table

Photo of Srikanth
Srikanth
Tue, 07 Mar 2023 09:30:20 UTC

> That’s surprising, can you run the queries in shard with `distributed_` in the truncate query? Ah, in this message, I actually meant *without distributed_* . I see it now.