1. Modify the table
MODIFY TTL changes the lifecycle rule on an existing table without recreating it.
ALTER TABLE eventsTyporithm · easy
Step 1 of 8 · intro card
Scale & Ops
A TTL clause expires or moves old data — e.g. TTL event_date + INTERVAL 90 DAY DELETE, or TO VOLUME 'cold'.
A TTL (time to live) rule tells ClickHouse when each row's data should be expired based on a date or time column.
With DELETE, rows older than the expression are dropped automatically during background merges — handy for retention windows.
Instead of deleting, TTL ... TO VOLUME 'cold' moves aging parts to cheaper disks, giving tiered storage for warm and cold data.
TTL expires or moves rows by age.
... DELETE enforces retention windows.
... TO VOLUME 'cold' tiers storage.
ALTER TABLE events
MODIFY TTL event_date + INTERVAL 90 DAY DELETE;Connect each part of the code to the concept before you type.
MODIFY TTL changes the lifecycle rule on an existing table without recreating it.
ALTER TABLE eventsThe TTL expression computes when each row expires, relative to a date column.
MODIFY TTL event_date + INTERVAL 90 DAYDELETE drops expired rows; alternatively TO VOLUME moves them to cheaper storage.
DELETERead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.