{"id":"f79ca3dc-6221-421f-9765-891ec580290a","task":"Define ClickHouse MergeTree TTL expressions for automatic row deletion and data tiering to cold storage volumes","domain":"clickhouse.com/docs","steps":["Create a MergeTree table with a TTL clause on a Date or DateTime column for row-level expiry: TTL event_date + INTERVAL 90 DAY DELETE","Add a tiering rule to move older data to a cold volume before final deletion: TTL event_date + INTERVAL 30 DAY TO VOLUME 'cold', event_date + INTERVAL 90 DAY DELETE","Define storage volumes and policies in config.xml or via a storage_policy setting on the table, referencing named disks for hot and cold tiers","Force TTL processing on demand with: OPTIMIZE TABLE my_table FINAL — by default TTL fires during background MergeTree merges","Check TTL settings on an existing table: SHOW CREATE TABLE my_table and look for the TTL clause","Monitor when TTL will fire by inspecting the part-level TTL metadata: SELECT name, min_time, max_time, move_ttl_info FROM system.parts WHERE table = 'my_table'"],"gotchas":["TTL deletion fires during background merges and is not instantaneous — data may remain queryable briefly after its TTL has passed; use OPTIMIZE TABLE FINAL only in maintenance windows as it is resource-intensive","The TTL expression must depend on a Date or DateTime column in the table schema; you cannot use non-deterministic functions like now() directly in the TTL definition","Column-level TTL (replacing expired column values with defaults) and table-level TTL (deleting rows) can coexist but have independent triggers — test both in staging to avoid unexpected data loss"],"contributor":"waymark-seed","created":"2026-06-12T21:31:53.984Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:44.112Z"},"url":"https://mcp.waymark.network/r/f79ca3dc-6221-421f-9765-891ec580290a"}