For an existing Query, TERMINATE QUERY will stop and delete the Query specified by query_id. Note that this does not delete any Entity or Relation created by the Query. Also note that once a Query is terminated, it is deleted and cannot be restarted. A terminated Query must be recreated using one of the Query statements.
TERMINATE QUERY cannot be undone. Use it with care!
See LIST QUERIES for accessing terminated queries.
Queries will only be visible if the current Role has USAGE privileges on them.
Arguments
query_id
This is the unique identifier of the Query to terminate. See LIST QUERIES to find out how to list all Queries that the user has access to. The first column (ID) in the response corresponds with the query_id.
query_name
This is the name of the Query to terminate. See LIST QUERIES to find out how to list all Queries that the user has access to. The column (Name) in the response corresponds with the query_name. The query_version property disambiguates between multiple queries with the same name.
query_version
This is the version of the Query to terminate. See LIST QUERIES to find out how to list all Queries that the user has access to. The column (Version) in the response corresponds with the query_version. If query_name is provided without a query_version, the latest query_version will be used.
Examples
Terminate a Query
The following is an example of how to terminate a Query. Note the ID from LIST QUERIES is the same as the query_id used in TERMINATE QUERY.
demo_db.public/demostore#LISTQUERIES;+--------------------------------------+-----------+----------+-----------------+---------------+-------------------------------+----------+-------------------------------+-------------------------------+
| ID | Name | Version | Intended State | Actual State | Query | Owner | Created At | Updated At |
+======================================+-----------+----------+=================+===============+===============================+==========+===============================+===============================+
| f6a96114-625a-4ea4-a0d9-46b7c5ababbc | demoquery | 1 | running | running | CREATE STREAM pageviews2 AS | sysadmin | 2023-02-08 22:08:25 +0000 UTC | 2023-02-08 22:08:25 +0000 UTC |
| | | | | | SELECT * FROM pageviews; | | | |
+--------------------------------------+-----------+----------+-----------------+---------------+-------------------------------+----------+-------------------------------+-------------------------------+
demo_db.public/demostore#TERMINATEQUERYf6a96114-625a-4ea4-a0d9-46b7c5ababbc;+-------+--------------------------------------+----------+------------------------------------------+|Type|Name|Command|Summary|+=======+======================================+==========+==========================================+|query|f6a96114-625a-4ea4-a0d9-46b7c5ababbc|DROP|query|||||f6a96114-625a-4ea4-a0d9-46b7c5ababbc|||||wasmarkedfortermination|+-------+--------------------------------------+----------+------------------------------------------+demo_db.public/demostore#TERMINATEQUERYdemoquery:1;+-------+--------------------------------------+----------+------------------------------------------+|Type|Name|Command|Summary|+=======+======================================+==========+==========================================+|query|f6a96114-625a-4ea4-a0d9-46b7c5ababbc|DROP|query|||||f6a96114-625a-4ea4-a0d9-46b7c5ababbc|||||wasmarkedfortermination|+-------+--------------------------------------+----------+------------------------------------------+