All Products
Search
Document Center

Lindorm:SHOW CONTINUOUS QUERIES

Last Updated:Aug 24, 2022

This topic describes the syntax that is used to query the existing continuous queries that run on the current database.

Syntax

show_cq_statement 
    ::=  SHOW CONTINUOUS QUERIES
Note

This statement displays all existing continuous queries that run on the current database. If you want to query the continuous queries that run on a different database, execute the USE statement to switch to the database.

Description of result sets

Column name

Type

Description

name

VARCHAR

The name of the continuous query.

interval

VARCHAR

The interval at which the continuous query is performed. This value is specified by the interval_string parameter in the CREATE CONTINUOUS QUERY statement.

query

VARCHAR

The statement that is executed in the continuous query.

Examples

Display all continuous queries that run on the current database.

SHOW CONTINUOUS QUERIES;
+-------+----------+--------------------------------+
| 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`)    |
+-------+----------+--------------------------------+
1 rows in set (66 ms)