Querying for tag values in a given list

2020-03-10 06:17发布

问题:

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.

回答1:

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/



标签: influxdb