Zurab Kiknavelidze
07/31/2026, 9:32 AMRocky
07/31/2026, 9:33 AMSUBMIT TASK is primarily handled through the DROP TASK command. The ability to "pause" (suspend) a task without deleting it was introduced later in version v4.1.
1. How to Drop a Task
To permanently remove a task and cancel any of its current executions (TaskRuns), use the DROP TASK statement.
sql
DROP TASK [IF EXISTS] <task_name> [FORCE];
* Effect: This removes the task definition from the system and automatically kills any currently running instances of that task.
* Example: DROP TASK IF EXISTS my_etl_task;
──────────
2. How to "Pause" a Task (v4.0 workaround)
In v4.0, there is no native ALTER TASK ... SUSPEND command (this is available starting from v4.1). To effectively "pause" a task in v4.0, you have two options:
* Option A (Recommended): DROP the task and re-SUBMIT it later when you want it to resume. Since SUBMIT TASK usually contains a simple SQL statement, you can keep the script and re-run it when needed.
* Option B (Modify Schedule): You cannot modify an existing task's schedule in v4.0 without dropping it. You must DROP and re-SUBMIT with a different schedule or no schedule.
──────────
3. How to Cancel a Running Task Instance (TaskRun)
If you want to stop a task that is currently running but keep the task definition for future runs, you can kill the specific query:
1. Find the Running Task: Query the task_runs metadata table to find the query_id or connection_id of the task currently in the RUNNING state.
sql
SELECT * FROM INFORMATION_SCHEMA.task_runs
WHERE task_name = 'your_task_name' AND state = 'RUNNING';
2. Kill the Query:
sql
KILL QUERY <query_id>;
Summary for v4.0
Action | Command
Drop Task | DROP TASK <task_name>;
Stop Running Instance | KILL QUERY <query_id>;
Pause Task | Not supported in v4.0; must DROP and re-SUBMIT.
Check Task Status | SELECT * FROM INFORMATION_SCHEMA.tasks;
*Note: If you upgrade to v4.1, you can use ALTER TASK <task_name> SUSPEND; to pause and ALTER TASK <task_name> RESUME; to restart tasks` to resume.*
References
• using_starrocks/Cost_based_optimizer.md
• sql-reference/sql-statements/cbo_stats/KILL_ANALYZE.md
• sql-reference/sql-statements/cluster-management/nodes_processes/KILL.md
• administration/management/resource_management/Query_management.md
• sql-reference/sql-statements/loading_unloading/ETL/DROP_TASK.md
• administration/management/compaction.md
• sql-reference/http_sql_api.md