v.23.11Improvement

Implement Asynchronous Execution for ALTER TABLE Partition Moves in ClickHouse

Implement user-level setting alter_move_to_space_execute_async which allow to execute queries ALTER TABLE ... MOVE PARTITION|PART TO DISK|VOLUME asynchronously. The size of pool for background executions is controlled by background_move_pool_size. Default behavior is synchronous execution. Fixes #47643. #56809 (alesapin).
Introduces a user-level setting alter_move_to_space_execute_async that enables asynchronous execution of ALTER TABLE ... MOVE PARTITION|PART TO DISK|VOLUME queries in ClickHouse.

Why it matters

This feature addresses the problem of long-running ALTER TABLE ... MOVE PARTITION|PART TO DISK|VOLUME queries blocking the client session by allowing these operations to be executed asynchronously in the background. It improves user experience and system responsiveness by offloading heavy data movement tasks, controlled via a background execution pool.

How to use it

To enable asynchronous execution of MOVE PARTITION or MOVE PART operations, set the user-level setting:

SET alter_move_to_space_execute_async = 1;


The concurrency of background moves is managed by the background_move_pool_size setting. By default, execution is synchronous.