Skip to content

InfluxQL not pulling back distinct tag values #26321

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

Closed
peterbarnett03 opened this issue Apr 24, 2025 · 2 comments
Closed

InfluxQL not pulling back distinct tag values #26321

peterbarnett03 opened this issue Apr 24, 2025 · 2 comments
Labels
area/influxql Issues related to InfluxQL query language kind/bug v3

Comments

@peterbarnett03
Copy link
Contributor

peterbarnett03 commented Apr 24, 2025

Potential Bug

We're seeing an oddity in InfluxQL's ability to pull back distinct values in a tag. This is happening on InfluxDB 3 Enterprise.

Filing as a potential bug as this may just be a lack in my knowledge of how InfluxQL works and its relation to SQL in this space. I've worked with the user on different approaches but getting the same results; documentation and Claude-assistance didn't come to a useful solution. Filing across InfluxQL and v3/Enterprise.

Context

The below query works using SQL:

influxdb3 query --database influx_poc 'select distinct order_type from stats_v11 '

+------------+
| order_type |
+------------+
| A1         |
| A2         |
| P1         |
| I1         |
| S4         |
+------------+

But below query is not working using InfluxQL:

influxdb3 query --database influx_poc --language influxql 'show tag values from stats_v11 with key = "order_type"'

++
++

Additional Context

To show that the query I was doing for is a valid tag key, I was querying for "order_type" here.

influxdb3 query --database influx_poc --language influxql 'show tag keys from stats_v11 '

+------------------+---------------------------------+
| iox::measurement | tagKey                          |
+------------------+---------------------------------+
| stats_v11        | ....                            |
| stats_v11        | ....                            |
| stats_v11        | dist_from_avg_bucket            |
| stats_v11        | order_type                      |
| stats_v11        | venue                           |
| stats_v11        | ....                            |
| stats_v11        | ....                            |
+------------------+---------------------------------+
@peterbarnett03 peterbarnett03 added area/influxql Issues related to InfluxQL query language kind/bug v3 labels Apr 24, 2025
@pauldix
Copy link
Member

pauldix commented Apr 25, 2025

What is the timestamp of the data you wrote in to test? SHOW TAG VALUES limits the look back period of the query to avoid killing the DB. Your SQL query instructs the DB to do a full table scan, which in real world scenarios would yield a query that times out (or possibly an OOM killed process).

@peterbarnett03
Copy link
Contributor Author

Solved via ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/influxql Issues related to InfluxQL query language kind/bug v3
Projects
None yet
Development

No branches or pull requests

2 participants