A time bucket is a fixed temporal interval that groups time-series observations for rollups such as average, maximum, minimum, or count calculations. TimescaleDB's time_bucket function assigns each timestamp to an interval such as 5 minutes, 10 minutes, 3 days, or 1 week. section 9.5.1
time_bucket(bucket_width, ts, [origin, timezone, offset])
Use the function signature to choose an interval and optionally control bucket alignment, timezone, and offset. section 9.5.1
Build a bucketed query by:
- Applying time_bucket to the timestamp, then grouping by the resulting period and any category such as activity. section 9.5.1
Workout heart-rate chart
A 10-minute bucket produces average and maximum heart rates for each workout period. The returned rows show periods such as 07:00, 07:10, and 07:20, making them suitable for charting.
Continuous aggregate
A five-minute bucket stores each device's minimum heart rate, low-rate count, and total measurements in a continuous aggregate. Querying bucket 02:35 returns five low readings and a true bradycardia_detected flag.








