Skip to main content
Since 1.16.0 Aggregate data into a space-saving aggregate, which stores frequency information in an intermediate form. You can then use any of the accessors in this group to return estimated frequencies or the most common elements. This differs from freq_agg in that you can specify a target number of values to keep, rather than a frequency cutoff.

Samples

Create a topN aggregate over the country column of the users table. Targets the top 10 most-frequent values:
Create a topN aggregate over the type column of the devices table. Estimates the skew of the data to be 1.05, and targets the 5 most-frequent values:

Arguments

The syntax is:

Returns