About Timescale hyperfunctions

Hyperfunctions allow you to perform critical time-series queries quickly, analyze time-series data, and extract meaningful information. They aim to identify, build, and combine all of the functionality SQL needs to perform time-series analysis into a single extension.

Some hyperfunctions are included in the default TimescaleDB product. For additional hyperfunctions, you need to install the PostgreSQL extension.

Here is a list of all the hyperfunctions provided by Timescale. Hyperfunctions marked ‘Toolkit’ require an installation of Timescale Toolkit. Hyperfunctions marked ‘experimental’ are still under development.

warning

Downsample functions

Hyperfunction typeHyperfunction nameToolkitExperimental
One step aggregateasap_smooth()
lttb()

Financial analysis functions

Hyperfunction typeHyperfunction nameToolkitExperimental
candlestick_agg() functions
Aggregatecandlestick_agg()
Pseudo aggregate
Accessorclose()
high()
low()
open()
volume()
Rolluprollup()
ohlc() functions
Aggregate
Accessorclose()
high()
low()
open()
Rolluprollup()

Frequency analysis functions

Hyperfunction typeHyperfunction nameToolkitExperimental
count_min_sketch() functions
Aggregatecount_min_sketch()
Accessor
freq_agg() functions
Aggregatefreq_agg()
Accessor
min_frequency(),
topn_agg() functions
Aggregatetopn_agg()
Accessor
min_frequency(),
topn()

Metric aggregation functions

Hyperfunction typeHyperfunction nameToolkitExperimental
counter_agg() functions
Aggregate
Accessorcorr()
delta()
extrapolated_rate()
, last_time()
, last_val()
, idelta_right()
interpolated_delta()
irate_left(),
num_changes()
num_resets()
slope()
Rolluprollup()
Mutator
gauge_agg() functions
Aggregategauge_agg()
Accessor
delta()
extrapolated_rate()
, idelta_right()
interpolated_delta()
irate_left(),
num_changes()
rate()
time_delta()
Rollup
Mutatorwith_bounds()

Minimum and maximum functions

Hyperfunction typeHyperfunction nameToolkitExperimental
max_n() functions
Aggregatemax_n()
Accessor
into_values()
Rollup
max_n_by() functions
Aggregatemax_n_by()
Accessor
Rolluprollup()
min_n() functions
Aggregate
Accessorinto_array()
Rolluprollup()
min_n_by() functions
Aggregate
Accessorinto_values()
Rollup

Percentile approximation functions

Hyperfunction typeHyperfunction nameToolkitExperimental
tdigest() functions
Aggregate
Accessorapprox_percentile()
mean()
Rolluprollup()
uddsketch() functions
Aggregate
Accessorapprox_percentile()
approx_percentile_rank()
mean()
Alternate aggregatepercentile_agg()
Rollup

State aggregates functions

Hyperfunction typeHyperfunction nameToolkitExperimental
heartbeat_agg() functions
Aggregateheartbeat_agg()
Accessor
downtime()
interpolated_downtime()
live_at()
uptime()
Rollup
state_agg() | timeline_agg() functions
Aggregatestate_agg(),
Accessorduration_in()
interpolated_state_periods()
into_values()
state_periods()

Statistical and regression analysis functions

Hyperfunction typeHyperfunction nameToolkitExperimental
stats_agg() (one variable) functions
Aggregate
Accessorkurtosis()
skewness()
sum()
average()
Rollup
rollup()
stats_agg() (two variables) functions
Aggregate
Accessoraverage_y(),
corr()
determination_coeff()
kurtosis_y(),
num_vals()
, skewness_x()
stddev_y(),
sum_y(),
variance_y(),
x_intercept()
Rollup
rollup()

Time weighted calculations functions

Hyperfunction typeHyperfunction nameToolkitExperimental
time_weight() functions
Aggregatetime_weight()
Accessor
first_time()
integral()
interpolated_integral()
last_val()
Rollup

For more information about each of the API calls listed in this table, see our .

Function pipelines are an experimental feature, designed to radically improve the developer ergonomics of analyzing data in PostgreSQL and SQL, by applying principles from functional programming and popular tools like Python’s Pandas, and PromQL.

SQL is the best language for data analysis, but it is not perfect, and at times can get quite unwieldy. For example, this query gets data from the last day from the measurements table, sorts the data by the time column, calculates the delta between the values, takes the absolute value of the delta, and then takes the sum of the result of the previous steps:

  1. SELECT device_id,
  2. FROM measurements
  3. WHERE ts >= now()-'1 day'::interval

Function pipelines are completely SQL compliant, meaning that any tool that speaks SQL is able to support data analysis using function pipelines.

For more information about how function pipelines work, read our .

Timescale Toolkit features are developed in the open. As features are developed they are categorized as experimental, beta, stable, or deprecated. This documentation covers the stable features, but more information on our experimental features in development can be found in the .