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 earliesttemperature
value based ontime
within an aggregate group. -
last
- Similar tofirst
, thelast
aggregate function lets us get the value of one column as ordered by another. For example,last(temperature, time)
would return the latesttemperature
value based ontime
within an aggregate group. -
time_bucket
- This function is akin to the standard PostgreSQLdate_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.