v.22.8Improvement

timeSlots Enhanced with DateTime64 Support for Subsecond Durations

timeSlots now works with DateTime64; subsecond duration and slot size available when working with DateTime64. #37951 (Andrey Zvonov).
timeSlots function now supports DateTime64 data type with subsecond precision and customizable slot sizes.

Why it matters

This feature extends the existing timeSlots function to work with DateTime64, allowing users to create time slots at subsecond intervals. It solves the problem of creating precise time slots for high-resolution timestamps, enabling more granular time series analysis and aggregation.

How to use it

Use the timeSlots function with columns of type DateTime64 to specify subsecond duration and slot size. For example, you can write:

SELECT timeSlots(datetime64_column, INTERVAL 100 MILLISECOND, INTERVAL 1 SECOND) FROM table


where the second argument defines the slot duration and the third argument the total slot size.