Get distinct values of tag

Please instruct, what is a proper options to get distinct values of tag (to use as a Grafana dashboard variable).

I am interested in working flightSQL analog of
v1.measurementTagValues(bucket: v.Environment, measurement: “log”, tag: “type”)

try to use

SELECT DISTINCT "type" FROM "log"  WHERE $__timeFilter(time);
SELECT "type" FROM "log" WHERE $__timeFilter(time) GROUP BY "type" ORDER BY "type";

(ORDER BY not provide order with it (( )

but with interval more than 7 days ($__timeFilter = time > now() - interval ‘7 days’)
i obtain this error

flightsql: rpc error: code = Internal desc = Error while planning query: External error: Query would exceed file limit of 432 parquet files. Please specify a smaller time range for your query. You can increase the file limit with the `--query-file-limit` option in the serve command, however, query performance will be slower and the server may get OOM killed or become unstable as a result

(and this on very small DB, with 2-3 weeks of data. )

432 - default setting for --query-file-limit, but this like 3 days interval max?
I am interested in filtering data (using dashboard variables) up to 1month interval.

Hi @va2dim

I believe that 432 (6 groups of 10 minutes per group x 24 hours per day x 3 days) is the limit in InfluxDB v3.

So your query will not work with more than 3 days of data.

Yes, that what I wrote,
is perhaps exists better options or best practises to get distinct values of a tag?

creating downsampling task to collect data for each variable like this look very interesting )), after switch to more powerfull data engine.
And increase --query-file-limit not look like good option if I correctly understand documentation.

This will not work correctly with more than 3 days interval in dashboard.

SELECT DISTINCT "type" FROM "log" WHERE time > now() - interval '3 days';