时序数据库InfluxDB的基本语法 (2)

By default, a GROUP BY time() interval with no data reports null as its value in the output column. fill() changes the value reported for time intervals that have no data. Note that fill() must go at the end of the GROUP BY clause if you’reGROUP(ing) BY several things (for example, both tags and a time interval).

3.5 ORDER BY time DESC

By default, InfluxDB returns results in ascending time order; the first point returned has the oldest timestamp and the last point returned has the most recent timestamp.ORDER BY time DESC reverses that order such that InfluxDB returns the points with the most recent timestamps first.

注意:ORDER by time DESC must appear after the GROUP BY clause if the query includes a GROUP BY clause. ORDER by time DESC must appear after the WHERE clause if the query includes a WHERE clause and no GROUP BY clause.

四.SHOW CARDINALITY

是用于估计或精确计算measurement、序列、tag key、tag value和field key的基数的一组命令。

SHOW CARDINALITY命令有两种可用的版本:估计和精确。估计值使用草图进行计算,对于所有基数大小来说,这是一个安全默认值。精确值是直接对TSM(Time-Structured Merge Tree)数据进行计数,但是,对于基数大的数据来说,运行成本很高。

下面以tag key、tag value为例。

4.1 SHOW TAG KEY CARDINALITY

估计或精确计算tag key集的基数。

ON <database>、FROM <sources>、WITH KEY = <key>、WHERE <condition>、GROUP BY <dimensions>和LIMIT/OFFSET子句是可选的。当使用这些查询子句时,查询将回退到精确计数(exect count)。当启用Time Series Index(TSI)时,才支持对time进行过滤。不支持在WHERE子句中使用time。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzgfyp.html