Should I use a field or a tag for a 10 million unique values?

I need to store a huge amount of user IDs (around 10 million) but I don’t know if I should use tags or fields. I don’t need to filter by those IDs, just GROUP BY (to get unique users, for example).

I know that fields are not indexed but do I need an index to do a GROUP BY?
What’s the better solution?

The general rule is to store data in tags if you plan on using GROUP BY. You can read a little on the recommendations here.

If you’re concerned about high cardinality with that data, you can enable TSI to help with that.