TL;DR Tech Tips: New Query Language Features in Version 1.3
By
Regan Kuchan /
Developer
Jun 22, 2017
Navigate to:
In this post, we give a preview of some new query language features in InfluxQL version 1.3.
New Operators
Version 1.3 introduces several new mathematical operators:
- Modulo (
%
) - Bitwise AND (
&
) - Bitwise OR (
|
) - Bitwise Exclusive-OR (
^
)
The following query calculates the moduli between two fields: cod
and pod
.
> SELECT "cod" % "pod" FROM "prod"
name: prod
time cod_pod
---- -------
2017-06-21T22:55:25Z 0
2017-06-21T22:56:25Z 1
2017-06-21T22:57:25Z 3
New time zone clause
InfluxQL’s new time zone clause returns the UTC offset for the specified timezone. The query below returns the UTC offset for Chicago’s time zone:
> SELECT "water_level" FROM "h2o_feet" WHERE "location" = 'santa_monica' AND time >= '2015-08-18T00:00:00Z' AND time <= '2015-08-18T00:18:00Z' tz('America/Chicago')
name: h2o_feet
time water_level
---- -----------
2015-08-17T19:00:00-05:00 2.064
2015-08-17T19:06:00-05:00 2.116
2015-08-17T19:12:00-05:00 2.028
2015-08-17T19:18:00-05:00 2.126
New duration unit
Duration units specify the time precision in InfluxQL queries and when writing data to InfluxDB. InfluxQL Version 1.3 introduces a new nanosecond duration unit: ns
.
The query below uses a GROUP BY time()
clause to group averages into 1000000000
nanosecond buckets:
> SELECT MEAN("value") FROM "gopher" WHERE time >= 1497481480598711679 AND time <= 1497481484005926368 GROUP BY time(1000000000ns)
What's next:
- Downloads for the TICK-stack are live on our "downloads" page.
- Deploy on the Cloud: Get started with a FREE trial of InfluxDB Cloud featuring fully-managed clusters, Kapacitor and Grafana.
- Deploy on Your Servers: Want to run InfluxDB clusters on your servers? Try a FREE 14-day trial of InfluxDB Enterprise featuring an intuitive UI for deploying, monitoring, and rebalancing clusters, plus managing backups and restores.
- Tell Your Story: Over 300 companies have shared their story on how InfluxDB is helping them succeed. Submit your testimonial and get a limited edition hoodie as a thank you.