KILL

Updated at:

Stops a specified instance that is in the Running state.

Syntax

kill <instance_id>;

Parameters

ParameterDescription
instance_idThe ID of the instance to stop. Each instance ID is unique. Only instances in the Running state are valid targets. If you specify an instance in any other state, an error is returned.

Usage notes

KILL is an asynchronous operation. After the system accepts the request, the distributed job is not immediately stopped — it is stopped at the next internal checkpoint. Run the STATUS statement to confirm the instance has been cancelled.

After KILL is executed, the system sets the task status to Cancel and checks that status at each internal checkpoint — including task waiting, before and after the compiler is run, during optimization by the optimizer, before and after a physical query plan is generated, before and after a computing task is submitted, before and after metadata is updated, and before and after execution result statistics are performed.

Example

The following example shows a typical workflow: find the running instance ID, stop it, then verify the status.

Step 1: Find the instance ID.

Run SHOW to view information about a known instance, or run TOP INSTANCE to view all instances currently running in the project.

Step 2: Stop the instance.

-- Stop instance 20131225123xxxxxxxxxxxxxxx
kill 20131225123xxxxxxxxxxxxxxx;

Step 3: Verify cancellation.

status 20131225123xxxxxxxxxxxxxxx;

After a successful KILL, the Status field returns Cancel:

Status: Cancel

What's next

  • SHOW: View instance information, including StartTime, RunTime, Status, InstanceID, Owner, and Query.

  • STATUS: Check the status of a specified instance.

  • TOP INSTANCE: View all instances running in a project.

  • DESC INSTANCE: Get job details by instance ID, including SQL, Owner, StartTime, EndTime, and Status.

  • WAIT: Get the run log of a job by instance ID, including Logview URLs.