ClickHouse/docs/en/operations/system-tables/view_refreshes.md
2024-06-25 08:44:34 +00:00

3.7 KiB

slug
/en/operations/system-tables/view_refreshes

view_refreshes

Information about Refreshable Materialized Views. Contains all refreshable materialized views, regardless of whether there's a refresh in progress or not.

Columns:

  • database (String) — The name of the database the table is in.
  • view (String) — Table name.
  • status (String) — Current state of the refresh.
  • last_refresh_result (String) — Outcome of the latest refresh attempt.
  • last_refresh_time (DateTime) — Time of the last refresh attempt. NULL if no refresh attempts happened since server startup or table creation.
  • last_success_time (DateTime) — Time of the last successful refresh. NULL if no successful refreshes happened since server startup or table creation.
  • duration_ms (UInt64) — How long the last refresh attempt took.
  • next_refresh_time (DateTime) — Time at which the next refresh is scheduled to start.
  • remaining_dependencies (Array(String)) — If the view has refresh dependencies, this array contains the subset of those dependencies that are not satisfied for the current refresh yet. If status = 'WaitingForDependencies', a refresh is ready to start as soon as these dependencies are fulfilled.
  • exception (String) — if last_refresh_result = 'Error', i.e. the last refresh attempt failed, this column contains the corresponding error message and stack trace.
  • retry (UInt64) — If nonzero, the current or next refresh is a retry (see refresh_retries refresh setting), and retry is the 1-based index of that retry.
  • refresh_count (UInt64) — Number of successful refreshes since last server restart or table creation.
  • progress (Float64) — Progress of the current refresh, between 0 and 1.
  • read_rows (UInt64) — Number of rows read by the current refresh so far.
  • total_rows (UInt64) — Estimated total number of rows that need to be read by the current refresh.

(There are additional columns related to current refresh progress, but they are currently unreliable.)

Example

SELECT
    database,
    view,
    status,
    last_refresh_result,
    last_refresh_time,
    next_refresh_time
FROM system.view_refreshes

┌─database─┬─view───────────────────────┬─status────┬─last_refresh_result─┬───last_refresh_time─┬───next_refresh_time─┐
 default   hello_documentation_reader  Scheduled  Finished             2023-12-01 01:24:00  2023-12-01 01:25:00 
└──────────┴────────────────────────────┴───────────┴─────────────────────┴─────────────────────┴─────────────────────┘