min_frequency() and max_frequency()
ToolkitTimescaleDB Toolkit functions are available under Timescale Community Edition. They are automatically included with Timescale Cloud. Click to learn more.ExperimentalExperimental features are not suitable for production environments. They are included under the TimescaleDB experimental schema. Click to learn more.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.
Name | Type | Description |
---|---|---|
agg | SpaceSavingAggregate | The frequency or top N aggregate created over the original dataset |
value | AnyElement | The value to find the frequency of |
Column | Type | Description |
---|---|---|
min_freq or max_freq | DOUBLE PRECISION | The 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