TL;DR InfluxDB Tech Tips – Series Cardinality, DELETE Function & Moving Data with InfluxDB 0.13

3 minutes

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

Calculating your series cardinality

Q: Is series cardinality for a single measurement really just the product of the number of tag values per tag?

For example, I have a single measurement with the tags `firstname`, `lastname`, and `email`. If `firstname` has 5 different values, `lastname` has 5 different values, and `email` has 5 different values, then is my series cardinality 125 (5 * 5 * 5)?

A: Series cardinality for a single measurement is actually the number of the tag sets that exist.

Working with your example, if we have the tags `firstname`, `lastname`, and `email`, the total cardinality is purely driven by the email tag. Although there are many possible first and last names, a given email address will only ever have one associated first and last name (assuming no one ever changes their name.) `firstname` and `lastname` are dependent variables, and email is the independent variable, so your series cardinality is actually five.

If we then add `phone_number` as another tag, that is a semi-independent variable. Any given email may be associated with zero or more phone numbers, and each number might be associated with more than one email (phone numbers get recycled over time.) Adding `phone_number` will increase the series cardinality, but not in a purely multiplicative way. For most emails there will still be only one phone number, and vice versa.

Move data to a different database

Q: How can I move data from one database to another database in InfluxDB?

A: An `INTO` query can copy data from one measurement or database to another. For example, move data from the measurement `initial_meas` in the database old to the measurement `final_meas` in the database `new`:

> SELECT * INTO new."default".final_meas FROM old."default".initial_meas

For more on `INTO` queries, check out our documentation in Data Exploration.

New DELETE series functionality

Q: I’m having trouble removing some bad data. How can I delete data based on their timestamp?

A: In InfluxDB 0.13, users will be able to use `DELETE`. Unlike `DROP SERIES`, `DELETE` does not drop series from the index and it supports time intervals in the `WHERE` clause. For example, delete all data in the database that occur before January 01, 2016:

> DELETE WHERE time < '2016-01-01'

InfluxDB 0.13 is available in the nightly downloads.

For more InfluxDB tips, check out our Frequently Encountered Issues page and feel free to post your questions in the InfluxDB users group.

What’s next?

  • Download and get started with InfluxDB!
  • Attend one of our FREE virtual training seminars.
  • Got a question and need an immediate answer from the InfluxData Support team? Support subscriptions with unlimited incidents start at just $399 a month. Check out all the support options here.

Related Blog Posts

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top