Hacker News new | ask | show | jobs
by sohooo 1103 days ago
You could take a look at Postgres + TimescaleDB extension, which offers a nice time_bucket() function on its hypertables[1]. You can also materialize using continuous aggregates („self updating“ materialized views).

1: https://docs.timescale.com/api/latest/hyperfunctions/time_bu...

1 comments

Thanks, this looks exactly what I want. Sensible interval origins [1] too (January 1, 2000 for months and years, and January 3 2000, a Monday, for weeks) and also configurable.

[1] https://docs.timescale.com/use-timescale/latest/time-buckets...