You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of version **0.11**, a cron job runs on weekends to assist in deleting expired data that may not have been cleaned up by ClickHouse's built-in TTL mechanism.
44
+
45
+
:::warning Performance Considerations
46
+
This job uses potentially long running **mutations** (`ALTER TABLE DELETE`), which are expensive operations that can impact ClickHouse's performance. We recommend running these operations only during off-peak hours (nights and weekends). During testing with **1 concurrent active** mutation (default), we did not observe significant CPU, memory, or latency increases.
47
+
:::
48
+
49
+
### Default Schedule
50
+
51
+
By default, the cleanup job runs:
52
+
53
+
-**Saturday**: 8pm and 10pm UTC
54
+
-**Sunday**: 12am, 2am, and 4am UTC
55
+
56
+
### Disabling the Job
57
+
58
+
To disable the cleanup job entirely:
59
+
60
+
```yaml
61
+
queue:
62
+
extraEnv:
63
+
- name: "ENABLE_CLICKHOUSE_TTL_CLEANUP_CRON"
64
+
value: "false"
65
+
```
66
+
67
+
### Configuring the Schedule
68
+
69
+
You can customize when the cleanup job runs by modifying the cron expressions:
To run the job on a single cron schedule, set both `CLICKHOUSE_TTL_CLEANUP_CRON_WEEKEND_EVENING` and `CLICKHOUSE_TTL_CLEANUP_CRON_WEEKEND_MORNING` to the same value. Job locking prevents overlapping executions.
84
+
:::
85
+
86
+
### Configuring Minimum Expired Rows Per Part
87
+
88
+
The job goes table by table, scanning parts and deleting data from parts containing a minimum number of expired rows. This threshold balances efficiency and thoroughness:
89
+
90
+
- **Too low**: Job scans entire parts to clear minimal data (inefficient)
91
+
- **Too high**: Job misses parts with significant expired data
Increasing concurrent DELETE operations can severely impact system performance. Monitor your system carefully and only increase this value if you can tolerate potentially slower insert and read latencies.
130
+
:::
131
+
132
+
### Emergency: Stopping Running Mutations
133
+
134
+
If you experience latency spikes and need to terminate a running mutation:
135
+
136
+
1. **Find active mutations**:
137
+
138
+
```sql
139
+
SELECT * FROM system.mutations WHERE is_done = 0;
140
+
```
141
+
142
+
Look for the `mutation_id` where the `command` column contains a `DELETE` statement.
143
+
144
+
2. **Kill the mutation**:
145
+
```sql
146
+
KILL MUTATION WHERE mutation_id = '<mutation_id>';
0 commit comments