Count distinct unions of two fields (count distinct combinations of two fields)

influxdb
influxql

#1

Hello,
I have Influxdb (v 1.7.1) table with schema like this one:

table_name
tags:  tag_1, tag_2, tag_3
fields:  field_1, field_2, field_3

all fields are varying a lot(millions different values) so cannot use them as tags, get into to many series errors

Result i need is count of distinct combinations between field_1 and field_2 grouped by days, and some tags

On PostgreSQL we achieve this with grouping field_1 and then counting distinct field_2 , rows are numerous and queries are getting to slow.

Im stuck with with distinct combinations between two fields, grouping part is easy. Distinct works only with one field influxdb. Idea was to concat them into another series and then count, influx has no such thing.

Per one field_1 value i have hundred thousands of not unique field_2 values. I have millions of field_1 and field_2 values, so moving them to tags and grouping is out of the question.

I need a strategy of possible aggregation of data till i get to that count.