- Hyperfunctions
- Approximate count distinct functions
- Downsample functions
- Financial analysis functions
- Frequency analysis functions
- Gapfilling and interpolation functions
- Metric aggregation functions
- Minimum and maximum functions
- Percentile approximation functions
- Saturating math functions
- State aggregates functions
- Statistical and regression analysis functions
- Time weighted calculations functions
- General functions
Hyperfunctions
Timescale hyperfunctions are a specialized set of functions that allow you to analyze time-series data. You can use hyperfunctions to analyze anything you have stored as time-series data, including IoT devices, IT systems, marketing analytics, user behavior, financial metrics, and cryptocurrency.
Some hyperfunctions are included in the default TimescaleDB product. For additional hyperfunctions, you need to install the Timescale Toolkit PostgreSQL extension.
For more information, see the hyperfunctions documentation.
Approximate count distinct functions
| Hyperfunction type | Hyperfunction name | Toolkit | Experimental |
|---|---|---|---|
| hyperloglog() functions | |||
| Aggregate | hyperloglog() | ✅ | |
| Alternate aggregate | approx_count_distinct() | ✅ | ✅ |
| Accessor | distinct_count() | ✅ | |
| stderror() | ✅ | ||
| Rollup | rollup() | ✅ |
Downsample functions
| Hyperfunction type | Hyperfunction name | Toolkit | Experimental |
|---|---|---|---|
| One step aggregate | asap_smooth() | ✅ | |
| gp_lttb() | ✅ | ✅ | |
| lttb() | ✅ |
Financial analysis functions
| Hyperfunction type | Hyperfunction name | Toolkit | Experimental |
|---|---|---|---|
| candlestick_agg() functions | |||
| Aggregate | candlestick_agg() | ✅ | ✅ |
| Pseudo aggregate | candlestick() | ✅ | ✅ |
| Accessor | close() | ✅ | ✅ |
| close_time() | ✅ | ✅ | |
| high() | ✅ | ✅ | |
| high_time() | ✅ | ✅ | |
| low() | ✅ | ✅ | |
| low_time() | ✅ | ✅ | |
| open() | ✅ | ✅ | |
| open_time() | ✅ | ✅ | |
| volume() | ✅ | ✅ | |
| vwap() | ✅ | ✅ | |
| Rollup | rollup() | ✅ | ✅ |
| ohlc() functions | |||
| Aggregate | ohlc() | ✅ | ✅ |
| Accessor | close() | ✅ | ✅ |
| close_time() | ✅ | ✅ | |
| high() | ✅ | ✅ | |
| high_time() | ✅ | ✅ | |
| low() | ✅ | ✅ | |
| low_time() | ✅ | ✅ | |
| open() | ✅ | ✅ | |
| open_time() | ✅ | ✅ | |
| Rollup | rollup() | ✅ | ✅ |
Frequency analysis functions
| Hyperfunction type | Hyperfunction name | Toolkit | Experimental |
|---|---|---|---|
| count_min_sketch() functions | |||
| Aggregate | count_min_sketch() | ✅ | ✅ |
| Accessor | approx_count() | ✅ | ✅ |
| freq_agg() functions | |||
| Aggregate | freq_agg() | ✅ | ✅ |
| Accessor | into_values() | ✅ | ✅ |
| min_frequency(), max_frequency() | ✅ | ✅ | |
| topn_agg() functions | |||
| Aggregate | topn_agg() | ✅ | ✅ |
| Accessor | into_values() | ✅ | ✅ |
| min_frequency(), max_frequency() | ✅ | ✅ | |
| topn() | ✅ | ✅ |
Gapfilling and interpolation functions
| Hyperfunction type | Hyperfunction name | Toolkit | Experimental |
|---|---|---|---|
| Bucket | time_bucket_gapfill() | ||
| Interpolator | interpolate() | ||
| locf() |
Metric aggregation functions
| Hyperfunction type | Hyperfunction name | Toolkit | Experimental |
|---|---|---|---|
| counter_agg() functions | |||
| Aggregate | counter_agg() | ✅ | |
| Accessor | corr() | ✅ | |
| counter_zero_time() | ✅ | ||
| delta() | ✅ | ||
| extrapolated_delta() | ✅ | ||
| extrapolated_rate() | ✅ | ||
| first_time(), last_time() | ✅ | ||
| first_val(), last_val() | ✅ | ||
| idelta_left(), idelta_right() | ✅ | ||
| intercept() | ✅ | ||
| interpolated_delta() | ✅ | ✅ | |
| interpolated_rate() | ✅ | ✅ | |
| irate_left(), irate_right() | ✅ | ||
| num_changes() | ✅ | ||
| num_elements() | ✅ | ||
| num_resets() | ✅ | ||
| rate() | ✅ | ||
| slope() | ✅ | ||
| time_delta() | ✅ | ||
| Rollup | rollup() | ✅ | |
| Mutator | with_bounds() | ✅ | |
| gauge_agg() functions | |||
| Aggregate | gauge_agg() | ✅ | ✅ |
| Accessor | corr() | ✅ | |
| delta() | ✅ | ||
| extrapolated_delta() | ✅ | ||
| extrapolated_rate() | ✅ | ||
| idelta_left(), idelta_right() | ✅ | ||
| intercept() | ✅ | ||
| interpolated_delta() | ✅ | ✅ | |
| interpolated_rate() | ✅ | ✅ | |
| irate_left(), irate_right() | ✅ | ||
| num_changes() | ✅ | ||
| num_elements() | ✅ | ||
| rate() | ✅ | ||
| slope() | ✅ | ||
| time_delta() | ✅ | ||
| Rollup | rollup() | ✅ | |
| Mutator | with_bounds() | ✅ |
Minimum and maximum functions
| Hyperfunction type | Hyperfunction name | Toolkit | Experimental |
|---|---|---|---|
| max_n() functions | |||
| Aggregate | max_n() | ✅ | ✅ |
| Accessor | into_array() | ✅ | ✅ |
| into_values() | ✅ | ✅ | |
| Rollup | rollup() | ✅ | ✅ |
| max_n_by() functions | |||
| Aggregate | max_n_by() | ✅ | ✅ |
| Accessor | into_values() | ✅ | ✅ |
| Rollup | rollup() | ✅ | ✅ |
| min_n() functions | |||
| Aggregate | min_n() | ✅ | ✅ |
| Accessor | into_array() | ✅ | ✅ |
| into_values() | ✅ | ✅ | |
| Rollup | rollup() | ✅ | ✅ |
| min_n_by() functions | |||
| Aggregate | min_n_by() | ✅ | ✅ |
| Accessor | into_values() | ✅ | ✅ |
| Rollup | rollup() | ✅ | ✅ |
Percentile approximation functions
| Hyperfunction type | Hyperfunction name | Toolkit | Experimental |
|---|---|---|---|
| tdigest() functions | |||
| Aggregate | tdigest() | ✅ | |
| Accessor | approx_percentile() | ✅ | |
| approx_percentile_rank() | ✅ | ||
| mean() | ✅ | ||
| num_vals() | ✅ | ||
| Rollup | rollup() | ✅ | |
| uddsketch() functions | |||
| Aggregate | uddsketch() | ✅ | |
| Accessor | approx_percentile() | ✅ | |
| approx_percentile_array() | ✅ | ✅ | |
| approx_percentile_rank() | ✅ | ||
| error() | ✅ | ||
| mean() | ✅ | ||
| num_vals() | ✅ | ||
| Alternate aggregate | percentile_agg() | ✅ | |
| Rollup | rollup() | ✅ |
Saturating math functions
| Hyperfunction type | Hyperfunction name | Toolkit | Experimental |
|---|---|---|---|
| One step operation | saturating_add() | ✅ | ✅ |
| saturating_add_pos() | ✅ | ✅ | |
| saturating_mul() | ✅ | ✅ | |
| saturating_sub() | ✅ | ✅ | |
| saturating_sub_pos() | ✅ | ✅ |
State aggregates functions
| Hyperfunction type | Hyperfunction name | Toolkit | Experimental |
|---|---|---|---|
| heartbeat_agg() functions | |||
| Aggregate | heartbeat_agg() | ✅ | ✅ |
| Accessor | dead_ranges() | ✅ | ✅ |
| downtime() | ✅ | ✅ | |
| interpolate() | ✅ | ✅ | |
| interpolated_downtime() | ✅ | ✅ | |
| interpolated_uptime() | ✅ | ✅ | |
| live_at() | ✅ | ✅ | |
| live_ranges() | ✅ | ✅ | |
| uptime() | ✅ | ✅ | |
| Rollup | rollup() | ✅ | ✅ |
| state_agg() | timeline_agg() functions | ||
| Aggregate | state_agg(), timeline_agg() | ✅ | ✅ |
| Accessor | duration_in() | ✅ | ✅ |
| interpolated_duration_in() | ✅ | ✅ | |
| interpolated_state_periods() | ✅ | ✅ | |
| interpolated_state_timeline() | ✅ | ✅ | |
| into_values() | ✅ | ✅ | |
| rollup() | ✅ | ✅ | |
| state_periods() | ✅ | ✅ | |
| state_timeline() | ✅ | ✅ |
Statistical and regression analysis functions
| Hyperfunction type | Hyperfunction name | Toolkit | Experimental |
|---|---|---|---|
| stats_agg() (one variable) functions | |||
| Aggregate | stats_agg() (one variable) | ✅ | |
| Accessor | kurtosis() | ✅ | |
| num_vals() | ✅ | ||
| skewness() | ✅ | ||
| stddev() | ✅ | ||
| sum() | ✅ | ||
| variance() | ✅ | ||
| average() | ✅ | ||
| Rollup | rolling() | ✅ | |
| rollup() | ✅ | ||
| stats_agg() (two variables) functions | |||
| Aggregate | stats_agg() (two variables) | ✅ | |
| Accessor | average_y(), average_x() | ✅ | |
| corr() | ✅ | ||
| covariance() | ✅ | ||
| determination_coeff() | ✅ | ||
| intercept() | ✅ | ||
| kurtosis_y(), kurtosis_x() | ✅ | ||
| num_vals() | ✅ | ||
| skewness_y(), skewness_x() | ✅ | ||
| slope() | ✅ | ||
| stddev_y(), stddev_x() | ✅ | ||
| sum_y(), sum_x() | ✅ | ||
| variance_y(), variance_x() | ✅ | ||
| x_intercept() | ✅ | ||
| Rollup | rolling() | ✅ | |
| rollup() | ✅ |
Time weighted calculations functions
| Hyperfunction type | Hyperfunction name | Toolkit | Experimental |
|---|---|---|---|
| time_weight() functions | |||
| Aggregate | time_weight() | ✅ | |
| Accessor | average() | ✅ | |
| first_time() | ✅ | ||
| first_val() | ✅ | ||
| integral() | ✅ | ✅ | |
| interpolated_average() | ✅ | ✅ | |
| interpolated_integral() | ✅ | ✅ | |
| last_time() | ✅ | ||
| last_val() | ✅ | ||
| Rollup | rollup() | ✅ |
General functions
| Hyperfunction type | Hyperfunction name | Toolkit | Experimental |
|---|---|---|---|
| Bucket | time_bucket() | ||
| timescaledb_experimental.time_bucket_ng() | ✅ | ||
| One step aggregate | approximate_row_count() | ||
| first() | |||
| histogram() | |||
| last() | |||
| One step operation | days_in_month() | ✅ | ✅ |
| month_normalize() | ✅ | ✅ |
