Skip to main content
CANCEL ALTER TABLE cancels the execution of the ongoing ALTER TABLE operation, including:
  • Modify columns.
  • Optimize table schema (from v3.2), including modifying the bucketing method and the number of buckets.
  • Create and delete the rollup index.
Note
  • This statement is a synchronous operation.
  • This statement requires you to have the ALTER_PRIV privilege on the table.
  • This statement only supports canceling asynchronous operations using ALTER TABLE (as mentioned above) and does not support canceling synchronous operations using ALTER TABLE, such as rename.

Syntax

Parameters

  • {COLUMN | OPTIMIZE | ROLLUP}
    • If COLUMN is specified, this statement cancels operations of modifying columns.
    • If OPTIMIZE is specified, this statement cancels operations of optimizing table schema.
    • If ROLLUP is specified, this statement cancels operations of adding or deleting the rollup index. You can further specify rollup_job_id to cancel specific rollup jobs.
  • db_name: optional. The name of the database to which the table belongs. If this parameter is not specified, your current database is used by default.
  • table_name: required. The table name.
  • rollup_job_id: optional. The ID of the rollup job. You can get the rollup job ID using SHOW ALTER MATERIALIZED VIEW.
  • FORCE: optional. An operator-only escape hatch for force-cancelling a COLUMN alter job on a shared-data (lake) table whose publish_version is permanently stuck in the FINISHED_REWRITING state (for example by a missing txnlog, a lost segment / SST file, or a persistent storage outage). A normal CANCEL ALTER TABLE refuses to cancel a job in FINISHED_REWRITING; FORCE bypasses that guard. Internally it performs a no-op publish (advancing the partition’s visible version without applying the alter’s changes) and then cancels the job, which unblocks subsequent loads on the table. Warning
    • FORCE is gated by the FE config enable_admin_skip_committed_txn (default false); enable it only during recovery and disable it again immediately afterwards. See ADMIN SKIP COMMITTED TRANSACTION for the shared config and the related transaction-level escape hatch.
    • FORCE is supported only for COLUMN alter jobs (schema change and metadata alter, such as enable_persistent_index / file_bundling) on shared-data (lake) tables. It is not supported for OPTIMIZE, ROLLUP, or materialized-view alters; using FORCE with those is rejected.
    • The alter being force-cancelled is discarded; the change does not take effect.

Examples

  1. Cancel the operation of modifying columns for example_table in the database example_db.
  2. Cancel the operation of optimizing table schema for example_table in the database example_db.
  3. Cancel the operation of adding or deleting the rollup index for example_table in the current database.
  4. Cancel specific rollup alterations for example_table in the current database using their job IDs.
  5. Force-cancel a publish-stuck COLUMN alter on a shared-data (lake) table (operator-only; requires enable_admin_skip_committed_txn=true).