Returns the minimum or maximum estimated frequencies of a value within a dataset.

max_frequency (
agg SpaceSavingAggregate,
value AnyElement
) RETURNS DOUBLE PRECISION

min_frequency and max_frequency are accessors that operate on a frequency aggregate or a top N aggregate. Create a frequency or top N aggregate over the original dataset, then call min_frequency and max_frequency on the aggregate.

NameTypeDescription
aggSpaceSavingAggregateThe frequency or top N aggregate created over the original dataset
valueAnyElementThe value to find the frequency of
ColumnTypeDescription
min_freq or max_freqDOUBLE PRECISIONThe minimum or maximum estimated frequency for the value
note

When you create a frequency aggregate, you set a threshold frequency. Values that appear with lower-than-threshold frequency are not tracked. Calling min_frequency or max_frequency with such values returns a frequency of 0.

Find the minimum frequency of the value 3 in a column named value within the table value_test:

SELECT toolkit_experimental.min_frequency(
(SELECT toolkit_experimental.freq_agg(0.05, value) FROM value_test),
3
);

Find the maximum frequency of the value foo in a column named value within the table value_test:

SELECT toolkit_experimental.max_frequency(
(SELECT toolkit_experimental.freq_agg(0.05, value) FROM value_test),
'foo'
);

Found an issue on this page?

Report an issue!

Keywords

Related Content