freq_agg or mcv_agg.
Samples
Get the 20 most frequentzip_codes from an employees table:
Arguments
The syntax is:| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agg | SpacingsavingAggregate | - | ✔ | A space-saving aggregate created using either freq_agg or mcv_agg |
n | INTEGER | - | ✔ | The number of values to return. Required only for frequency aggregates. For top N aggregates, defaults to target N of the aggregate itself, and requests for a higher N return an error. In some cases, the function might return fewer than N values. This might happen if a frequency aggregate doesn’t contain N values above the minimum frequency, or if the data isn’t skewed enough to support N values from a top N aggregate. |
Returns
| Column | Type | Description |
|---|---|---|
| topn | AnyElement | The N most-frequent values in the aggregate |