Node Management

Show Child Paths

  1. SHOW CHILD PATHS pathPattern

Return all child paths and their node types of all the paths matching pathPattern.

node types: ROOT -> DB INTERNAL -> DATABASE -> INTERNAL -> DEVICE -> TIMESERIES

Example:

  • return the child paths of root.ln:show child paths root.ln
  1. +------------+----------+
  2. | child paths|node types|
  3. +------------+----------+
  4. |root.ln.wf01| INTERNAL|
  5. |root.ln.wf02| INTERNAL|
  6. +------------+----------+
  7. Total line number = 2
  8. It costs 0.002s

get all paths in form of root.xx.xx.xx:show child paths root.xx.xx

Show Child Nodes

  1. SHOW CHILD NODES pathPattern

Return all child nodes of the pathPattern.

Example:

  • return the child nodes of root:show child nodes root
  1. +------------+
  2. | child nodes|
  3. +------------+
  4. | ln|
  5. +------------+
  • return the child nodes of root.ln:show child nodes root.ln
  1. +------------+
  2. | child nodes|
  3. +------------+
  4. | wf01|
  5. | wf02|
  6. +------------+

Count Nodes

IoTDB is able to use COUNT NODES <PathPattern> LEVEL=<INTEGER> to count the number of nodes at the given level in current Metadata Tree considering a given pattern. IoTDB will find paths that match the pattern and counts distinct nodes at the specified level among the matched paths. This could be used to query the number of devices with specified measurements. The usage are as follows:

  1. IoTDB > COUNT NODES root.** LEVEL=2
  2. IoTDB > COUNT NODES root.ln.** LEVEL=2
  3. IoTDB > COUNT NODES root.ln.wf01.** LEVEL=3
  4. IoTDB > COUNT NODES root.**.temperature LEVEL=3

As for the above mentioned example and Metadata tree, you can get following results:

  1. +------------+
  2. |count(nodes)|
  3. +------------+
  4. | 4|
  5. +------------+
  6. Total line number = 1
  7. It costs 0.003s
  8. +------------+
  9. |count(nodes)|
  10. +------------+
  11. | 2|
  12. +------------+
  13. Total line number = 1
  14. It costs 0.002s
  15. +------------+
  16. |count(nodes)|
  17. +------------+
  18. | 1|
  19. +------------+
  20. Total line number = 1
  21. It costs 0.002s
  22. +------------+
  23. |count(nodes)|
  24. +------------+
  25. | 2|
  26. +------------+
  27. Total line number = 1
  28. It costs 0.002s

Note: The path of timeseries is just a filter condition, which has no relationship with the definition of level.

Show Devices

  • SHOW DEVICES pathPattern? (WITH DATABASE)? limitClause? #showDevices

Similar to Show Timeseries, IoTDB also supports two ways of viewing devices:

  • SHOW DEVICES statement presents all devices’ information, which is equal to SHOW DEVICES root.**.
  • SHOW DEVICES <PathPattern> statement specifies the PathPattern and returns the devices information matching the pathPattern and under the given level.

SQL statement is as follows:

  1. IoTDB> show devices
  2. IoTDB> show devices root.ln.**

You can get results below:

  1. +-------------------+---------+
  2. | devices|isAligned|
  3. +-------------------+---------+
  4. | root.ln.wf01.wt01| false|
  5. | root.ln.wf02.wt02| false|
  6. |root.sgcc.wf03.wt01| false|
  7. | root.turbine.d1| false|
  8. +-------------------+---------+
  9. Total line number = 4
  10. It costs 0.002s
  11. +-----------------+---------+
  12. | devices|isAligned|
  13. +-----------------+---------+
  14. |root.ln.wf01.wt01| false|
  15. |root.ln.wf02.wt02| false|
  16. +-----------------+---------+
  17. Total line number = 2
  18. It costs 0.001s

isAligned indicates whether the timeseries under the device are aligned.

To view devices’ information with database, we can use SHOW DEVICES WITH DATABASE statement.

  • SHOW DEVICES WITH DATABASE statement presents all devices’ information with their database.
  • SHOW DEVICES <PathPattern> WITH DATABASE statement specifies the PathPattern and returns the devices’ information under the given level with their database information.

SQL statement is as follows:

  1. IoTDB> show devices with database
  2. IoTDB> show devices root.ln.** with database

You can get results below:

  1. +-------------------+-------------+---------+
  2. | devices| database|isAligned|
  3. +-------------------+-------------+---------+
  4. | root.ln.wf01.wt01| root.ln| false|
  5. | root.ln.wf02.wt02| root.ln| false|
  6. |root.sgcc.wf03.wt01| root.sgcc| false|
  7. | root.turbine.d1| root.turbine| false|
  8. +-------------------+-------------+---------+
  9. Total line number = 4
  10. It costs 0.003s
  11. +-----------------+-------------+---------+
  12. | devices| database|isAligned|
  13. +-----------------+-------------+---------+
  14. |root.ln.wf01.wt01| root.ln| false|
  15. |root.ln.wf02.wt02| root.ln| false|
  16. +-----------------+-------------+---------+
  17. Total line number = 2
  18. It costs 0.001s

Count Devices

  • COUNT DEVICES <PathPattern>

The above statement is used to count the number of devices. At the same time, it is allowed to specify PathPattern to count the number of devices matching the PathPattern.

SQL statement is as follows:

  1. IoTDB> show devices
  2. IoTDB> count devices
  3. IoTDB> count devices root.ln.**

You can get results below:

  1. +-------------------+---------+
  2. | devices|isAligned|
  3. +-------------------+---------+
  4. |root.sgcc.wf03.wt03| false|
  5. | root.turbine.d1| false|
  6. | root.ln.wf02.wt02| false|
  7. | root.ln.wf01.wt01| false|
  8. +-------------------+---------+
  9. Total line number = 4
  10. It costs 0.024s
  11. +--------------+
  12. |count(devices)|
  13. +--------------+
  14. | 4|
  15. +--------------+
  16. Total line number = 1
  17. It costs 0.004s
  18. +--------------+
  19. |count(devices)|
  20. +--------------+
  21. | 2|
  22. +--------------+
  23. Total line number = 1
  24. It costs 0.004s