New Heartbeat and Timeline Hyperfunctions Available in Toolkit 1.13.0

The Timescale Toolkit team is proud to announce the 1.13.0 version of the TimescaleDB Toolkit extension! This version is now available as part of our HA Docker image, as a DEB or RPM package, or as source code in our GitHub repository. Toolkit 1.13.0 will be released on Timescale Cloud and Managed Service for TimescaleDB in January.

Welcome, Heartbeat Aggregate! :heartbeat:

Users can use the new heartbeat_agg(timestamp, start_time, agg_interval, heartbeat_interval) to track the liveness of a system in the range (start_time, start_time + agg_interval). Each timestamp in that range is assumed to indicate system liveness for the following heartbeat_interval.

Once constructed, users can query heartbeat aggregates for uptime and downtime, as well as query for live_ranges or dead_ranges. Users can also check for live_at(timestamp).

Heartbeat aggregates can also be interpolated to better see behaviors around the boundaries of the individual aggregates.

Developer Benefits of Heartbeat Aggregate

Developers can use heartbeat aggregates to identify system downtimes quickly. They can also use them with TimescaleDB’s continuous aggregates to build daily views, which can then be rolled into larger intervals. They can even combine heartbeat aggregates from different systems over the same time period to check for overlapping failures.

New Timeline Aggregate and Improved State Aggregate

The new timeline_agg aggregate is similar to state_agg but tracks the entire state timeline (the timestamps when states are entered and exited) instead of just the duration in each state. timeline_agg supports the same hyperfunctions as state_agg, in addition to new hyperfunctions that operate on the entire history of states. Both state_agg and timeline_agg also support states stored as integers and the rollup hyperfunction.

Developer Benefits of New Timeline Aggregate and Improved State Aggregate

Developers can use state_agg and timeline_agg to track the amount of time spent in a small number of states. Now with integer states, states can act as the IDs of foreign keys in a table with all possible states. With support for rollup, developers can optimize their queries by aggregating multiple time periods at once and then rolling them up. And with timeline_agg, it’s possible to determine when a state was entered and exited, in addition to the duration in that state.

New Experimental Features

  • New heartbeat aggregate, heartbeat_agg
  • Expose tdigest type
    • This is a prototype for building tdigest objects client-side for INSERT into tables. This is a lightly tested prototype; try it out at your own risk! (examples)
  • ASOF JOINs for time vectors
    • This allows users to join two time vectors with the following semantics timevectorA -> asof(timevectorB). This will return records with the LOCF value from timevectorA at the timestamps from timevectorB. Specifically, the returned records contain for each value in timevectorB {the LOCF value from timevectorA, the value from timevectorB, the timestamp from timevectorB}.
  • New approx_percentile_array() function
    • Users can try the new toolkit_experimental.approx_percentile_array(percentiles) to generate an array of percentile results instead of having to call and rebuild the aggregate multiple times.
  • New timeline_agg aggregate
  • Support rollup for state_agg and timeline_agg
  • Support integer states for state_agg and timeline_agg
  • Introducing Time Vector Templates
    • Users can try the new experimental function toolkit_experimental.to_text(timevector(time, value),format_string) to render a formatted text representation of their time vector series. These changes also include toolkit_experimental.to_plotly(timevector(time, value)), which will render your time vector series in a format suitable with Plotly.

Bug Fixes

  • Fix bugs in the candlestick aggregate and re-enable partial aggregation to take full advantage of parallel aggregation offered by PostgreSQL.

Other Notable Changes

  • Upgrade to PGX 0.6.1 for experimental support for PostgreSQL 15.
  • Adds Rocky Linux 9 support.

Give Toolkit 1.13.0 a spin

We encourage everyone to try out this new version of the Toolkit and let us know what you think! We’d love to hear about any improvements or adjustments you’d like to make to the experimental functions (even if you like them the way they are and would like to see them outside our experimental schema). You can reply to this post, send us a note in our Slack channel, or add an issue to the toolkit repository. Thank you!

4 Likes