v.19.3New Features

Added Function Tostartoftenminutes()

Added function toStartOfTenMinutes(). #4298 (Vitaly Baranov)
Added the function toStartOfTenMinutes() which rounds a given datetime value down to the start of the nearest 10-minute interval.

Why it matters

This function simplifies time bucketing by 10-minute intervals, enabling easier aggregation and analysis of data grouped by fixed 10-minute blocks, which is useful for time series analysis and data summarization in ClickHouse.

How to use it

Use the toStartOfTenMinutes() function by passing a DateTime or DateTime64 value as the argument. It returns a timestamp rounded down to the closest previous 10-minute mark. For example:

SELECT toStartOfTenMinutes(event_time) FROM table