Three questions that get expensive
Three questions come up constantly in systems that handle large volumes of data, and all three have easy exact answers that stop working at scale.
Membership. Have I seen this item before? Exactly answered by a hash set, which stores every distinct item.
Cardinality. How many distinct items have I seen? Exactly answered by the same hash set, counting its entries.
Frequency. How many times have I seen this particular item? Exactly answered by a hash map from item to counter.
Each solution stores something per distinct item, so memory grows with the number of distinct items. That is fine for thousands and untenable for billions, and it is untenable in a way no engineering fixes: the structures are not wasteful, they are storing the minimum an exact answer requires.
The alternative is to stop requiring an exact answer, and to be precise about what is given up instead.

