Skip to content

Mutations and Processes

Syatem.mutations

Get Recently

bash
SELECT * FROM system.mutations WHERE is_done = 0 ORDER BY create_time LIMIT 5\G
bash
Row 1:
──────
database:                   journal
table:                      otel_logs
mutation_id:                mutation_6444807.txt
command:                    MATERIALIZE TTL
create_time:                2025-01-16 15:10:56
block_numbers.partition_id: ['']
block_numbers.number:       [6444807]
parts_to_do_names:          ['20250115_6108934_6186810_156','20250116_6262846_6373744_248']
parts_to_do:                2
is_done:                    0
latest_failed_part:
latest_fail_time:           1970-01-01 08:00:00
latest_fail_reason:

Kill by Mutation ID

sql
KILL MUTATION WHERE mutation_id = 'foo';

Kill by DB and Table

sql
KILL MUTATION WHERE database = 'foo' AND table = 'foo';

Kill by DB

sql
KILL MUTATION WHERE database = 'foo';

System.processes

Get Query Processes

bash
SELECT * FROM system.processes WHERE query LIKE '%TTL%' LIMIT 5\G
Modify TTL Query
bash
Row 1:
──────
is_initial_query:     1
user:                 default
query_id:             f6a3a976-3617-4c41-a7e5-091ab868ea1b
address:              ::ffff:10.244.6.64
port:                 10749
initial_user:         default
initial_query_id:     f6a3a976-3617-4c41-a7e5-091ab868ea1b
initial_address:      ::ffff:10.244.6.64
initial_port:         10749
interface:            1
os_user:              kuga
client_hostname:      kugambp-2020
client_name:          ClickHouse client
client_revision:      54471
client_version_major: 24
client_version_minor: 10
client_version_patch: 3
http_method:          0
http_user_agent:
http_referer:
forwarded_for:
quota_key:
distributed_depth:    0
elapsed:              593.567582
is_cancelled:         0
is_all_data_sent:     0
read_rows:            0
read_bytes:           0
total_rows_approx:    0
written_rows:         0
written_bytes:        0
memory_usage:         0
peak_memory_usage:    0
query:                ALTER TABLE journal.otel_logs
MODIFY TTL toDateTime(Timestamp) + toIntervalDay(31);
query_kind:           Alter
thread_ids:           [1794]
ProfileEvents:        {'Query':1,'FileOpen':3,'ReadBufferFromFileDescriptorRead':2,'ReadBufferFromFileDescriptorReadBytes':1838,'WriteBufferFromFileDescriptorWrite':2,'WriteBufferFromFileDescriptorWriteBytes':1924,'FileSync':2,'FileSyncElapsedMicroseconds':50448,'ReadCompressedBytes':36,'CompressedReadBufferBlocks':1,'CompressedReadBufferBytes':10,'IOBufferAllocs':4,'IOBufferAllocBytes':1083517,'DiskReadElapsedMicroseconds':3,'DiskWriteElapsedMicroseconds':30,'ContextLock':45,'RWLockAcquiredReadLocks':1}
Settings:             {'log_queries':'0','log_query_threads':'0'}
current_database:     journal