TL;DR InfluxDB Tech Tips – November 10, 2016

Regan Kuchan — November 10, 2016

In this weekly post we recap the most interesting InfluxDB and TICK-stack related issues, workarounds, how-tos and Q&A from GitHub, IRC and the InfluxDB Google Group that you might have missed in the last week or so.

Where time begins and ends in InfluxDB

Q: What’s the maximum timestamp that InfluxDB can handle?

A: The maximum timestamp is 9223372036854775806 or 2262-04-11T23:47:16.854775806Z. The minimum timestamp is -9223372036854775806 or 1677-09-21T00:12:43.145224194Z.

InfluxDB returns a parsing error if your point has a timestamp outside that time range.

InfluxDB’s default query time range

Q: What time range does InfluxDB cover when my query doesn’t specify a time range in the WHERE clause?

For example, what points does InfluxDB include in the query below?

SELECT max("potato") FROM "tomato"

A: In InfluxDB versions 1.0 and under, a query’s default time range is between 1677-09-21 00:12:43.145224194 UTC and now(). So if you’d like your query to include points with timestamps that occur after now(), the query must provide an alternative upper time bound in the WHERE clause. For example, query data with timestamps between 1677-09-21 00:12:43.145224194 and 1000 days after now():

SELECT max("potato") FROM "tomato" WHERE time < now() + 1000d

The behavior in InfluxDB versions 1.1+ is slightly different. For most SELECT statements in versions 1.1+, the default time range is between 1677-09-21 00:12:43.145224194 and 2262-04-11T23:47:16.854775806Z UTC. For SELECT statements with a GROUP BY time() clause, the default time range is between 1677-09-21 00:12:43.145224194 UTC and now().

So in versions 1.1+, you no longer need to provide an alternative upper time bound in the WHERE clause to query data after now() – unless your query includes a GROUP BY time() clause. InfluxDB version 1.1.0RC1 is available on the downloads page.

Configure returned timestamps

Q: It seems like the HTTP API returns RFC3339-formatted timestamps and the CLI returns epoch nanosecond timestamps? Is there a way to configure the timestamps returned by those tools?

A: With HTTP API, use the epoch query string parameter to receive timestamps in epoch format at your precision of choice. In the CLI, you can specify alternative timestamp formats with the precision <format> command.

For more InfluxDB tips, see our Frequently Asked Questions page and feel free to post your questions in the InfluxDB users group!

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 InfluxCloud 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 InfluxEnterprise featuring an intuitive UI for deploying, monitoring and rebalancing clusters, plus managing backups and restores. 
  • Tell Your Story: Over 100 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.