In this post we recap the week’s most interesting InfluxDB and TICK-stack related issues, timestamp precision, multiple fields function, and common field value workarounds, how-tos and Q&A from GitHub, IRC and the InfluxDB Google Group that you might have missed.
Performance implications of timestamp precision
Q: I’m writing second-resolution data to InfluxDB using the HTTP API. Does it matter if I specify nanosecond precision timestamps with no `precision` query string parameter or second precision timestamps with the `precision` parameter?
So, is there any benefit to using one of the two following 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'
A: Yes. To maximize performance we recommend using the coarsest possible timestamp precision when writing data to InfluxDB. Specifying `precision=s` is the way to go!
Performing the same function on multiple fields
Q: I want to calculate the average for every field in a single measurement. Currently, I’m using the query below which takes a long time to write out. Is there a better way to do this?
> SELECT mean("alarm") AS "ave_alarm",mean("guests") AS "ave_guests",mean("temperature") AS "ave_temperature" FROM "home" name: home ---------- time ave_alarm ave_guests ave_temperature 0 0 1 70
A: Yes! Starting with version 1.0, aggregation functions support using an `*` to specify all fields in the measurement.
> SELECT mean(*) FROM "home" name: home ---------- time mean_alarm mean_guests mean_temperature 0 0 1 70
Finding the most common field value
Q: Is there a way to find the most common field value in a field?
A: Starting with version 1.0, InfluxDB supports the `mode()` function which finds the most frequent value in a field. Check out the functions page for more information.
- Looking for InfluxDB clustering on your infrastructure? Get started with InfluxDB Enterprise Beta, now available for evaluation.
- Download and get started with InfluxDB 1.0 RC1
- Schedule a FREE 20 minute consultation with a Solutions Architect to review your InfluxDB project
- Attend one of our FREE virtual training seminars.