InfluxDB---Data exploration

Source: Internet
Author: User
Tags influxdb

1. The Group by clause and fill ()

In general, a group by interval uses a null output to represent data that has no value, and fill () can be used to change the output without a value. The Fill () option includes

    • Any number
    • NULL: Set NULL for output with no data within interval
    • Previous: Copy the value of the previous interval as output without data
    • None: Skip No value

The following example shows the use of fill ()

GROUP by without Fill ()

Example 1

SELECT MEAN(water_level) FROM h2o_feet WHERE time >= ‘2015-08-18‘ AND time < ‘2015-09-24‘ GROUP BY time(10d)
结果
name: h2o_feet--------------time                 mean2015-08-13T00:00:00Z   4.3062120833333232015-08-23T00:00:00Z   4.3189446293670292015-09-02T00:00:00Z   4.3638776812047812015-09-12T00:00:00Z    4.69811470811633?2015-09-22T00:00:00Z
GROUP BY with fill()
例子2
Use fill() with -100:
SELECT MEAN(water_level) FROM h2o_feet WHERE time >= ‘2015-08-18‘ AND time < ‘2015-09-24‘ GROUP BY time(10d) fill(-100)
结果
name: h2o_feet--------------time                 mean2015-08-13T00:00:00Z   4.3062120833333232015-08-23T00:00:00Z   4.3189446293670292015-09-02T00:00:00Z   4.3638776812047812015-09-12T00:00:00Z   4.698114708116322?2015-09-22T00:00:00Z   -100

Example 3
Use fill() with none :
SELECT MEAN(water_level) FROM h2o_feet WHERE time >= ‘2015-08-18‘ AND time < ‘2015-09-24‘ GROUP BY time(10d) fill(none)
Results
name: h2o_feet--------------time               mean2015-08-13T00:00:00Z 4.3062120833333232015-08-23T00:00:00Z 4.3189446293670292015-09-02T00:00:00Z 4.3638776812047812015-09-12T00:00:00Z 4.69811470811633?

Note: If you use Group (ing) by something (for example, have tags and a time interval), fill () must be placed at the end of group by.
 

InfluxDB---Data exploration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.