JPC
JPC

Reputation: 1919

Querying for tag values in a given list

Is there any shortform syntax in influxdb to query for membership in a list? I'm thinking of something along the lines of

SELECT * FROM some_measurement WHERE some_tag IN ('a', 'b', 'c')

For now I can string this together using ORed =s, but that seems very inefficient. Any better approaches? I looked through the language spec and I don't see this as a possibility in the expression productions.

Another option I was thinking was using the regex approach, but that seems like a worse approach to me.

Upvotes: 14

Views: 10908

Answers (1)

beckettsean
beckettsean

Reputation: 1836

InfluxDB 0.9 supports regex for tag matching. It's the correct approach although of course regex can be problematic. It's not a performance issue for InfluxDB, and in fact would likely be faster than multiple chained OR statements. There is no support yet for clauses like IN or HAVING.

For example: SELECT * FROM some_measurement WHERE some_tag =~ /a|b|c/

Upvotes: 27

Related Questions