Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize regexp on single tag values #7486

Closed
kostasb opened this issue Oct 19, 2016 · 0 comments
Closed

Optimize regexp on single tag values #7486

kostasb opened this issue Oct 19, 2016 · 0 comments

Comments

@kostasb
Copy link

kostasb commented Oct 19, 2016

Queries matching a single tag value using regexp :

SELECT myaggregation(myfield) FROM "mymeasurement" WHERE mytag =~ /^mytagvalue$/ AND time > now() - 15m

can be optimized to work on a direct tag match instead:

SELECT myaggregation(myfield) FROM "mymeasurement" WHERE mytag = 'mytagvalue' AND time > now() - 15m

E.g. it is possible for Grafana to generate such queries when selecting a single value from a template (e.g. tag values as templates) because regexps are available in the query editor.

InfluxDB could detect =~ /^foo$/ and rewrite that to = 'foo' and turn the linear scan into an index lookup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants