v.21.2Improvements

Added SUPPORT for WITH ... REFRESH Clause in LIVE VIEW Tables

Added support for WITH ... [AND] [PERIODIC] REFRESH [interval_in_sec] clause when creating LIVE VIEW tables. #14822 (vzakaznikov).
Added support for the WITH ... [AND] [PERIODIC] REFRESH [interval_in_sec] clause when creating LIVE VIEW tables in ClickHouse.

Why it matters

This feature enables users to specify periodic automatic refresh intervals for LIVE VIEW tables, allowing the views to update their data at defined time intervals. It solves the problem of manually refreshing live views and improves efficiency by automating updates based on the given period.

How to use it

When creating a LIVE VIEW, use the WITH ... REFRESH [interval_in_sec] or WITH ... AND REFRESH [interval_in_sec] clause to define the refresh interval in seconds. For example:

CREATE LIVE VIEW view_name
WITH REFRESH 10
AS
SELECT ...

This sets the live view to refresh its data every 10 seconds automatically.