v.21.6New Feature

New deltaSumTimestamp Aggregate Function for Ordered Row Summation

New aggregate function deltaSumTimestamp for summing the difference between consecutive rows while maintaining ordering during merge by storing timestamps. #21888 (Russ Frank).
Introduces the new aggregate function deltaSumTimestamp which sums the differences between consecutive timestamp rows while preserving order during merges.

Why it matters

This feature addresses the need to accurately calculate the total elapsed time or sum of time differences between sequential timestamp entries. It ensures correct ordering is maintained even when merging data parts, providing precise aggregation for time series or event data.

How to use it

Use the deltaSumTimestamp function in your SELECT queries where you need to sum time differences between consecutive rows. It can be applied as a standard aggregate function, for example:

SELECT deltaSumTimestamp(timestamp_column) FROM table_name;

No additional setup is required, as the function internally manages ordering and merging semantics.