Versions:
freq_agg()
ToolkitTimescaleDB Toolkit functions are available under Timescale Community Edition. They are automatically included with Timescale Cloud. Click to learn more.ExperimentalExperimental TimescaleDB Toolkit functions are not suitable for production environments. They may have bugs and may cause data loss. Click to learn more.The freq_agg
aggregate uses the SpaceSaving algorithm
to estimate the most common elements of a set. This API takes a sizing parameter and
a PostgreSQL column, and returns a FreqAgg object that can be passed to
other freq_agg APIs.
warning
Experimental features could have bugs. They might not be backwards compatible, and could be removed in future releases. Use these features at your own risk, and do not use any experimental features in production.
Name | Type | Description |
---|---|---|
freq | DOUBLE PRECISION | Minimum frequency (0.0-1.0) needed to keep track of a value |
value | AnyElement | Column to aggregate |
Column | Type | Description |
---|---|---|
agg | SpaceSavingAggregate | An object storing the most common elements of the given table and their estimated frequency. |
This example creates frequency aggregate over a field ZIP
in a HomeSales
table. This aggregate tracks any ZIP
value that occurs in at least 5% of rows.
SELECT toolkit_experimental.freq_agg(0.05, ZIP) FROM HomeSales;
Found an issue on this page?
Report an issue!Keywords