ClickHouse/docs/en/operations/system-tables/view_refreshes.md
2024-09-03 23:08:24 +00:00

4.0 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.
  • uuid (UUID) — Table uuid (Atomic database).
  • status (String) — Current state of the refresh.
  • last_success_time (Nullable(DateTime)) — Time when the latest successful refresh started. NULL if no successful refreshes happened since server startup or table creation.
  • last_success_duration_ms (Nullable(UInt64)) — How long the latest refresh took.
  • last_refresh_time (Nullable(DateTime)) — Time when the latest refresh attempt finished (if known) or started (if unknown or still running). NULL if no refresh attempts happened since server startup or table creation.
  • last_refresh_replica (String) — If coordination is enabled, name of the replica that made the current (if running) or previous (if not running) refresh attempt.
  • next_refresh_time (Nullable(DateTime)) — Time at which the next refresh is scheduled to start, if status = Scheduled.
  • exception (String) — Error message from previous attempt if it failed.
  • retry (UInt64) — How many failed attempts there were so far, for the current refresh.
  • progress (Float64) — Progress of the current refresh, between 0 and 1. Not available if status is RunningOnAnotherReplica.
  • read_rows (UInt64) — Number of rows read by the current refresh so far. Not available if status is RunningOnAnotherReplica.
  • read_bytes (UInt64) — Number of bytes read during the current refresh. Not available if status is RunningOnAnotherReplica.
  • total_rows (UInt64) — Estimated total number of rows that need to be read by the current refresh. Not available if status is RunningOnAnotherReplica.
  • written_rows (UInt64) — Number of rows written during the current refresh. Not available if status is RunningOnAnotherReplica.
  • written_bytes (UInt64) — Number rof bytes written during the current refresh. Not available if status is RunningOnAnotherReplica.

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 
└──────────┴────────────────────────────┴───────────┴─────────────────────┴─────────────────────┴─────────────────────┘