All Products
Search
Document Center

Lindorm:SHOW CONTINUOUS QUERIES

Last Updated:Mar 19, 2024

You can use the SHOW CONTINUOUS QUERIES syntax to view all existing continuous queries in the current database. To view continuous queries in other databases, you can use the USE syntax to change the current database.

Applicable engines and versions

The SHOW CONTINUOUS QUERIES syntax is applicable only to all versions of LindormTSDB.

Syntax

show_cq_statement ::=  SHOW CONTINUOUS QUERIES

Returned results

Column name

Type

Description

name

VARCHAR

The name of the continuous query that you want to perform.

interval

VARCHAR

The interval at which the continuous query is performed. For more information, see CREATE CONTINUOUS QUERY.

window

VARCHAR

The time window of the data. Data that is updated within the latest specified time window is used by the calculation tasks in the continuous query. For more information, see CREATE CONTINUOUS QUERY.

offset

VARCHAR

The offset of the data time window. For more information, see CREATE CONTINUOUS QUERY.

query

VARCHAR

The statement that is executed in the continuous query.

Examples

View all continuous queries in the current database.

SHOW CONTINUOUS QUERIES;

The following result is returned:

+-------+----------+--------------------------------+
| name  | interval |             query              |
+-------+----------+--------------------------------+
| my_cq | 1d       | INSERT INTO                    |
|       |          | `db_sensor_year`.`sensor`      |
|       |          | (SELECT MEAN(`temperature`)  |
|       |          | AS `temperature`,              |
|       |          | MEAN(`humidity`) AS          |
|       |          | `humidity`, `device_id`,       |
|       |          | `region` FROM                  |
|       |          | `db_sensor_month`.`sensor`)    |
+-------+----------+--------------------------------+