TL;DR InfluxDB Tech Tips - Naming Guidelines in InfluxDB, Selecting Tags with No Value & Writing Data to InfluxDB
By
Regan Kuchan /
Product, Developer
Feb 09, 2017
Navigate to:
In this weekly post we recap the most interesting InfluxDB time 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.
Naming guidelines in InfluxDB
Q: I’m trying to write some data to InfluxDB. My writes seem to succeed but I can’t query the data; any idea what’s going on here?
> INSERT energy,time=morning index=2.3 <--- No error > SELECT * FROM "energy" name: energy time index <--- The time tag doesn't appear in the results ---- ----- 2017-02-08T22:16:39.290463266Z 2.3
A: time
is a special keyword in InfluxDB. time
can be a continuous query name, database name, measurement name, retention policy name, subscription name, and user name. In those cases, time
does not require double quotes in queries. time
cannot be a field key or tag key. If Line Protocol includes time
as a field key or tag key, InfluxDB accepts the write and returns a 204
, but InfluxDB silently drops that field key or tag key and its associated value.
Check out the Frequently Asked Questions page for more information.
Selecting tags with no tag value
Q: How do I SELECT
data with a tag that has no value?
A: Specify an empty tag value with ''
. For example:
> SELECT * FROM "vases" WHERE priceless=''
name: vases
-----------
time origin priceless
2016-07-20T18:42:00Z 8
Writing data to InfluxDB
Q: I’ve recently started working with InfluxDB. When I write data to the database, does the precision of the timestamp matter?
A: Yes. To maximize performance we recommend using the coarsest possible timestamp precision when writing data to InfluxDB.
For example, we recommend using the second of the following two requests:
curl -i -XPOST "http://localhost:8086/write?db=weather" --data-binary 'temperature,location=1 value=90 1472666050000000000'
curl -i -XPOST "http://localhost:8086/write?db=weather&precision=s" --data-binary 'temperature,location=1 value=90 1472666050'
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.