v.22.8New Feature

Add nowInBlock Function for Current Time Retrieval in ClickHouse

Add function nowInBlock which allows getting the current time during long-running and continuous queries. Closes #39522. Notes: there are no functions now64InBlock neither todayInBlock. #39533 (Alexey Milovidov).
Introduces the nowInBlock function to retrieve the current timestamp consistently within long-running and continuous queries in ClickHouse.

Why it matters

The nowInBlock function addresses the problem of varying current timestamps during extended query execution, providing a stable and consistent time value throughout the processing of a data block. This ensures reliable time-based computations in long-running queries.

How to use it

Use the function nowInBlock() within your queries exactly as you would use now(). It returns the fixed current time for the duration of processing a data block, making it suitable for long-running or continuous query scenarios.