ReferenceSQL ReferenceStatements

KILL MUTATION

Stop matching active table mutations in the selected database.

KILL MUTATION

This page describes statements accepted by the Query API in RawTree Cloud and RawTree BYOC. Its restrictions apply to the API, not to all RawTree SQL. See ClickHouse compatibility and API scope.

Syntax

KILL MUTATION WHERE table = '<table>'
KILL MUTATION WHERE table = '<table>' AND mutation_id = '<mutation_id>'

The database filter comes from the request's selected database. Conditions can appear in either order.

Clauses

ClauseMeaning
tableRequired table name.
mutation_idOptional ID from system.mutations.

Query API behavior

  • Supported: A table condition with an optional mutation ID.
  • Not exposed by the Query API: Database names in the statement, other conditions, and backslash escapes.
  • Query API scope: The selected database is added to the mutation filter.

Errors

Error: Unsupported KILL statement.

Hint:

Only KILL MUTATION WHERE table = '<table>' [AND mutation_id = '<mutation_id>'] is supported. The selected database is applied automatically; find mutation ids in system.mutations.

For a target with a backslash, the API returns this error.

Backslash escapes are not supported in KILL MUTATION targets.

Hint:

Use literal characters and double single quotes to escape a quote.

Examples

Add a projection.

ALTER TABLE events ADD PROJECTION by_tenant (SELECT `__raw_data.tenant`, count() GROUP BY `__raw_data.tenant`)

Materialize it for existing parts.

ALTER TABLE events MATERIALIZE PROJECTION by_tenant

Inspect mutations before you choose a target.

SELECT mutation_id, command, is_done, is_killed FROM system.mutations WHERE database = currentDatabase() AND table = 'events'

Stop unfinished mutations for the table.

KILL MUTATION WHERE table = 'events'