Skip to main content

Commonly Used Hyperfunctions

Here are some of the Hyperfunctions we frequently use that might be useful in your own queries:

  • first - This aggregate function allows us to obtain the value of one column as ordered by another. For instance, first(temperature, time) would return the earliest temperature value based on time within an aggregate group.

  • last - Similar to first, the last aggregate function lets us get the value of one column as ordered by another. For example, last(temperature, time) would return the latest temperature value based on time within an aggregate group.

  • time_bucket - This function is akin to the standard PostgreSQL date_bin function. However, it differs in that it allows for arbitrary time intervals of months or longer. The return value is the start time of the bucket.

For a comprehensive list of Hyperfunctions, please refer to the TimescaleDB documentation site.