Lucas Chiesa
08/04/2026, 8:06 AMMICROSECONDS_DIFF doesn't exist on 4.1.3 is it going to be available in future oss releases?Rocky
08/04/2026, 8:06 AMMICROSECONDS_DIFF in StarRocks, including in version 4.1.3 or the current 3.x releases.
While StarRocks supports microsecond precision for the DATETIME data type and provides functions like microseconds_add(), microseconds_sub(), and date_trunc('microsecond', ...) (since v3.1.7), the specific "diff" functions have not yet been extended to microseconds in the official OSS releases.
Current Status and Alternatives
As of version 4.1.x:
* date_diff and TIMESTAMPDIFF: These functions support units up to millisecond, but not microsecond.
* milliseconds_diff: Returns the difference in milliseconds as a BIGINT.
* Workaround: If you require microsecond precision, you currently have to calculate it manually using the millisecond difference as a base, although there is no simple built-in way to extract the remaining microseconds for a delta calculation in a single step.
Future Availability
There is no publicly confirmed timeline or roadmap entry for a MICROSECONDS_DIFF function in future OSS releases. However, StarRocks has been progressively adding sub-second support to date-time functions (e.g., adding millisecond to TIMESTAMPDIFF in v3.2).
Recommendations:
1. Feature Request: If this is a blocker for your use case, I recommend opening a feature request on the StarRocks GitHub repository or upvoting existing issues related to microsecond-aware functions (such as Issue #17499).
2. Use Milliseconds: If millisecond precision is sufficient, you can use:
sql
SELECT milliseconds_diff(end_time, start_time);
-- OR
SELECT date_diff('millisecond', end_time, start_time);
If you are migrating from another system that used this function, you may need to adjust your logic to use milliseconds_diff until native microsecond support is added to the diffing functions.
References
• sql-reference/sql-functions/date-time-functions/time_slice.md
• sql-reference/sql-functions/date-time-functions/second.md
• sql-reference/sql-functions/date-time-functions/microseconds_sub.md
• sql-reference/sql-functions/date-time-functions/microseconds_add.md
• sql-reference/sql-functions/variant-functions/get_variant.md
• sql-reference/sql-functions/date-time-functions/date_trunc.md