Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Querying for tag values in a given list

Tags:

influxdb

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.

like image 967
JPC Avatar asked Aug 18 '15 03:08

JPC


1 Answers

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/

like image 149
beckettsean Avatar answered Sep 22 '22 13:09

beckettsean