Lists all continuous queries in the current database. To view continuous queries in a different database, use the USE statement to switch databases first.
Applicable engines and versions
The SHOW CONTINUOUS QUERIES statement applies to all versions of LindormTSDB.
Syntax
show_cq_statement ::= SHOW CONTINUOUS QUERIESReturned results
| Column name | Type | Description |
|---|---|---|
| name | VARCHAR | The name of the continuous query. |
| interval | VARCHAR | The interval at which the continuous query runs. For more information, see CREATE CONTINUOUS QUERY. |
| window | VARCHAR | The time window of the data. Only data updated within the latest time window is included in the continuous query's calculations. 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 executed in the continuous query. |
Examples
List 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`) |
+-------+----------+--------------------------------+