TERMINATE QUERY

Syntax

TERMINATE QUERY [query_id | query_name[:query_version]];

Description

TERMINATE QUERY stops and deletes the query specified by query_id. Note that this does not delete any entity or relation created by the query.

See LIST QUERIES for accessing terminated queries.

Queries are visible only 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# LIST QUERIES;
+--------------------------------------+-----------+----------+-----------------+---------------+-------------------------------+----------+-------------------------------+-------------------------------+
|  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# TERMINATE QUERY f6a96114-625a-4ea4-a0d9-46b7c5ababbc;
+-------+--------------------------------------+----------+------------------------------------------+
|  Type |  Name                                |  Command |  Summary                                 |
+=======+======================================+==========+==========================================+
| query | f6a96114-625a-4ea4-a0d9-46b7c5ababbc | DROP     | query                                    |
|       |                                      |          | f6a96114-625a-4ea4-a0d9-46b7c5ababbc     |
|       |                                      |          | was marked for termination               |
+-------+--------------------------------------+----------+------------------------------------------+

demo_db.public/demostore# TERMINATE QUERY demoquery:1;
+-------+--------------------------------------+----------+------------------------------------------+
|  Type |  Name                                |  Command |  Summary                                 |
+=======+======================================+==========+==========================================+
| query | f6a96114-625a-4ea4-a0d9-46b7c5ababbc | DROP     | query                                    |
|       |                                      |          | f6a96114-625a-4ea4-a0d9-46b7c5ababbc     |
|       |                                      |          | was marked for termination               |
+-------+--------------------------------------+----------+------------------------------------------+

Last updated