v.23.7Improvement
Functions date_diff and age Enhanced for Microsecond Precision
Functionsdate_diffandagenow support millisecond/microsecond unit and work with microsecond precision. #51291 (Dmitry Kardymon).
Why it matters
This feature enhances time interval calculations by extending support to finer time units such as milliseconds and microseconds. It solves the problem of limited precision in date and time difference functions, allowing users to perform more accurate time-based analytics and operations.How to use it
Users can now specify"millisecond" or "microsecond" as the unit parameter in the date_diff and age functions to get results with microsecond precision. For example:SELECT date_diff('microsecond', toDateTime64('2024-01-01 00:00:00.000000', 6), toDateTime64('2024-01-01 00:00:00.123456', 6));