tencent cloud

Schema Query
Last updated: 2025-04-29 23:07:44
Schema Query
Last updated: 2025-04-29 23:07:44
SQL
Meaning
Compatibility
Semantics
SHOW DATABASES
Query all databases.
SHOW DATABASES
SHOW SERIES

Query time series data that meets specified conditions.
The execution semantics:
SHOW SERIES [FROM_clause] [WHERE <tag_key> <operator> [ '<tag_value>' | <regular_expression>]] [LIMIT_clause] [OFFSET_clause] [ORDER BY ASC/DESC]
FROM_clause: required parameter, used to specify the measurement name to query. Syntax: FROM <measurement_name>. For example: FROM cpu_usage.
WHERE <tag_key> <operator> [ '<tag_value>' | <regular_expression> ]: optional parameter, used to specify query conditions. Among them, <tag_key> is the tag name, <operator> is the comparison operator, and <tag_value> or <regular_expression> is the comparison value. Multiple WHERE clauses can be used to combine multiple conditions with AND or OR. Example: WHERE host='server1' AND region='us-west'.
LIMIT_clause: optional parameter, used to specify the maximum number of rows in query results. Syntax: LIMIT <n>, where <n> is the maximum number of rows. For example: LIMIT 10.
OFFSET_clause: optional parameter, used to specify the offset of query results. Syntax: OFFSET <n>, where <n>
is the offset. For example: OFFSET 5.
ORDER BY ASC/DESC: optional parameter, used to specify the sorting method of query results. Syntax: ORDER BY <field> ASC/DESC, where <field> is the name of the field to be sorted, ASC means ascending order, and DESC means descending order. For example: ORDER BY time DESC.
The execution example:
SHOW SERIES FROM yottadb_partition_replicas_num_lzl where cluster_name = 'yottadb-capd-gz-dataplane6' ORDER BY ASC LIMIT 5 OFFSET 5

SHOW MEASUREMENTS

Get all available measurement names in the current InfluxDB instance.
The execution semantics:
SHOW MEASUREMENTS [WITH MEASUREMENT <operator> ['<measurement_name>' | <regular_expression>]][WHERE <tag_key> <operator> ['<tag_value>' | <regular_expression>]][LIMIT_clause] [OFFSET_clause] [ORDER BY ASC/DESC]
SHOW MEASUREMENTS: Specify that the query target is a measured value.
WITH MEASUREMENT: optional parameter, used to filter the measured values more precisely. You can use operators, measurement value names, or regular expressions to specify filter conditions.
WHERE: optional parameter, used to filter measurement values based on tags. You can use tag keys, operators, tag values, or regular expressions to specify filter conditions.
LIMIT_clause: optional parameter, used to limit the number of query results.
OFFSET_clause: optional parameter, used to specify the offset of query results.
ORDER BY ASC/DESC: optional parameter, used to specify the sorting method of query results. ASC means ascending order, and DESC means descending order.
Find all measurements named sensor_data where tag location is equal to room1 and tag sensor_type matches the result of the regular expression /temperature/.
SHOW MEASUREMENTS WITH MEASUREMENT = 'sensor_data' WHERE location = 'room1' AND sensor_type =~ /temperature/
SHOW TAG KEYS

Query statements for tag keys in the InfluxDB database.
The execution semantics:
SHOW TAG KEYS [FROM_clause] [WHERE <tag_key> <operator> ['<tag_value>' | <regular_expression>]] [LIMIT_clause] [OFFSET_clause] [ORDER BY ASC/DESC] [SIMIT_clause] [SOFFSET_clause]
SHOW TAG KEYS: The target of the identification query is the tag key.
FROM_clause: optional parameter, used to specify the measurement value to query. If this parameter is omitted, the tag keys for all measurement values will be queried.
WHERE: optional parameter, used to filter tag keys based on tags. You can use tag keys, operators, tag values, or regular expressions to specify filter conditions.
LIMIT_clause: optional parameter, used to limit the number of query results.
OFFSET clause: optional parameter, used to specify the offset of query results.
ORDER BY ASC/DESC: optional parameter, used to specify the sorting method of query results. ASC means ascending order, and DESC means descending order.
SIMIT_clause: optional parameter, used to limit the number of tag values returned by each tag key in return results.
SOFFSET_clause: optional parameter, used to specify the offset of tag values returned by each tag key in returned results.
The execution example:
This query will return all tag keys for measured values containing the condition cluster_name = 'yottadb-capd-gz-dataplane6', and arrange them in alphabetical order. The result set will be limited to the first 5 tag keys, starting from the 2nd tag key. For each tag key, only the first two tag values will be returned, beginning from the 3rd tag value.
SHOW TAG KEYS WHERE cluster_name = 'yottadb-capd-gz-dataplane6' ORDER BY ASC LIMIT 5 OFFSET 1 SLIMIT 2 SOFFSET 2
SHOW TAG VALUES

Query all tag values of a specific tag key for the measured value.
The execution semantics:
SHOW TAG VALUES [FROM_clause] WITH KEY [ [<operator> "<tag_key>" | <regular_expression>] | [IN ("<tag_key1>","<tag_key2")]] [WHERE <tag_key> <operator> ['<tag_value>' | <regular_expression>]] [LIMIT_clause] [OFFSET_clause] [ORDER BY ASC/DESC] [S
IMIT_clause] [SOFFSET_clause]
Compared with SHOW TAG KEYS, add parameters WITH KEY to specify the tag key name of tag values to be retrieved.
[<operator> "<tag_key>" | <regular_expression>]: optional parameter, used to specify the tag key name of the tag value to be retrieved. You can use the equal sign (=), not equal sign (!=), regular expression, or IN operator to match the tag key. If this parameter is omitted, the tag values of all tag keys will be returned.
[IN ("<tag_key1>","<tag_key2")]: optional parameter, used to specify a list of tag key names of tag values to be retrieved. If this parameter is omitted, the tag values of all tag keys will be returned.
[WHERE <tag_key> <operator> ['<tag_value>' | <regular_expression>]]: optional parameter, used to specify filter conditions and only return tag values that meet the conditions. You can use the equal sign (=), not equal sign (!=), regular expression, IN operator, greater-than sign (>), less-than sign (<), greater-than-or-equal-to sign (>=), or less-than-or-equal-to sign (<=) to match tag values. If this parameter is omitted, all tag values that meet the conditions will be returned.
The execution example:
This query will return all tag values of three tag keys (account_id, cluster_display_name, and cluster_name), sorted in ascending order. The number of tag values returned by each tag key is limited to 2, and the offset of tag values returned by each tag key is 1. In addition, this query limits the number of rows in the returned result set to 8 and returns results starting from the 2nd tag value.
SHOW TAG VALUES WITH KEY IN (account_id, cluster_display_name, cluster_name) ORDER BY ASC LIMIT 8 OFFSET 1 SLIMIT 2 SOFFSET 1
SHOW FIELD KEYS

Display all field keys for the specified measured value. Each field key includes information such as the name, data type, and whether it is a tag field.
The execution semantics:
SHOW FIELD KEYS [FROM <measurement_name>] [LIMIT_clause] [OFFSET_clause]
[ORDER BY ASC/DESC] [SIMIT_clause] [SOFFSET_clause]
Refer to the SHOW MEASUREMENTS for parameter meaning, where:
SIMIT_clause: limits the number of values returned by each field key.
SOFFSET_clause: specifies the offset of values returned by each field key.
The execution example:
This query statement will get field keys from the yottadb_partition_replicas_num table and sort them in ascending order. Then, it will return results of 4 rows starting from row 5. Specifically, it will return the results of rows 5 to 8, with each row containing one field key.
SHOW FIELD KEYS FROM yottadb_partition_replicas_num ORDER BY ASC LIMIT 4 OFFSET 4
SHOW SERIES CARDINALITY
Display the count of all time series data in the database, and support filtering and grouping by measurement, tag key, or tag value, as well as limiting the number and offset of return results.
The execution semantics:
SHOW SERIES CARDINALITY [FROM <measurement_name>] [where_clause] [group_by_clause] [LIMIT_clause] [OFFSET_clause] [SIMIT_clause] [SOFFSET_clause]
FROM <measurement_name>: optional parameter to specify the measurement name to query. If not specified, all measurements will be queried.
where_clause: optional parameter to specify tag keys and tag values to filter. Format: WHERE <tag_key>='<tag_value>' [AND <tag_key>='<tag_value>']
group_by_clause: optional parameter to group results by tag key. Format: GROUP BY <tag_key>
LIMIT_clause: optional parameter to limit the number of returned results. Format: LIMIT <limit>
OFFSET_clause: optional parameter to return results starting from the specified offset in the result set. OFFSET <offset>
SIMIT_clause: optional parameter to limit the number of returned results for each group. Format: SLIMIT <slimit>
SIMIT_clause: optional parameter to return results starting from the specified offset of each group. Format: SOFFSET <soffset>
The execution example:
This instance will get all time series data with the tag region us-west and host server-1 from the cpu_usage measurement, and group them by the tag cpu_type. It will also limit the number of returned results to 10, starting from row 21, and limit the number of returned results per group to 5, starting from row 3 of each group.
SHOW SERIES CARDINALITY FROM cpu_usage WHERE region='us-west' AND host='server-1' GROUP BY cpu_type LIMIT 10 OFFSET 20 SLIMIT 5 SOFFSET 2

SHOW FIELD KEY CARDINALITY
Display the count of field keys for all measurements in the database.
-
SHOW MEASUREMENT CARDINALITY
Display the number of all measurements in the database.
-
SHOW TAG KEY CARDINALITY
Display the count of tag keys for all measurements in the database.
-
SHOW TAG VALUES CARDINALITY
Display the count of tag values of the specified tag key in the database.

SHOW RETENTION  POLICIES
Display the retention policy in the specified database.

SHOW SHARDS
Display all shards in the specified database.

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback