Conference Schedule - PGConf NYC 2021

How PostgreSQL aggregation works and how it inspired the design of TimescaleDB’s hyperfunctions

Level: Intermediate

Time-series data comes at you fast, sometimes generating millions of data points per second. Because of this volume and rate of information, time-series data can be (famously) annoying to query and analyze.

One of the most popular functionalities of TimescaleDB, a Postgres extension aimed to supercharge it for time-series, is its hyperfunctions - a series of SQL functions that make it easier to manipulate and analyze time-series data with fewer lines of code. Interestingly, we built our hyperfunctions taking advantage of the internal structure of Postgres aggregations. In this talk, we explain to you why and how we did it.

We’ll start by diving deep into how aggregates work in Postgres, presenting how even if on the surface they seem to follow a one-step aggregation approach, actually almost all PostgreSQL aggregates do a version of two-step aggregation. We’ll explain why this is a good thing, jumping into how this Postgres design inspired us to implement a two-step aggregation design pattern for our aggregate functions. To end, you’ll get a deep-dive into how our design works, and how to use them with our popular continuous aggregates.


Ryan Booz