跳转到主内容
跳转到主内容

system.view_refreshes

在 ClickHouse Cloud 中进行查询

该系统表中的数据保存在 ClickHouse Cloud 中每个节点的本地。因此,如需获得所有数据的完整视图,需要使用 clusterAllReplicas 函数。更多详情请参阅此处

描述

关于可刷新物化视图 (Refreshable Materialized Views) 的信息。包含所有可刷新物化视图,无论当前是否有刷新在进行。

  • database (String) — 该表所在数据库的名称。
  • view (String) — 表名。
  • uuid (UUID) — 表的 uuid (Atomic 数据库) 。
  • status (String) — 刷新的当前状态。
  • last_success_time (Nullable(DateTime)) — 最近一次成功刷新开始的时间。如果自服务器启动或表创建以来从未成功刷新过,则为 NULL。
  • last_success_duration_ms (Nullable(UInt64)) — 最近一次刷新的耗时。
  • last_refresh_time (Nullable(DateTime)) — 最近一次刷新尝试结束的时间 (如果已知) ,或开始的时间 (如果未知或仍在运行) 。如果自服务器启动或表创建以来从未进行过刷新尝试,则为 NULL。
  • last_refresh_replica (String) — 如果启用了 coordination,则为发起当前 (如果正在运行) 或上一次 (如果未运行) 刷新尝试的副本名称。
  • next_refresh_time (Nullable(DateTime)) — 下一次计划开始刷新的时间,仅当 status = Scheduled 时适用。
  • exception (String) — 如果上一次尝试失败,则为对应的错误消息。
  • retry (UInt64) — 当前刷新截至目前的失败尝试次数。如果状态为 RunningOnAnotherReplica,则不可用。
  • progress (Nullable(Float64)) — 给定副本上当前正在运行或最近一次完成的刷新的进度,取值范围为 0 到 1。如果状态为 RunningOnAnotherReplica 或刷新未在运行,则为 NULL。
  • read_rows (Nullable(UInt64)) — 给定副本上当前正在运行或最近一次完成的刷新所读取的行数。如果状态为 RunningOnAnotherReplica,则为 NULL。
  • read_bytes (Nullable(UInt64)) — 给定副本上当前正在运行或最近一次完成的刷新所读取的字节数。如果状态为 RunningOnAnotherReplica,则为 NULL
  • total_rows (Nullable(UInt64)) — 给定副本上当前正在运行或最近一次完成的刷新预计需要读取的总行数。如果状态为 RunningOnAnotherReplica,则为 NULL
  • written_rows (Nullable(UInt64)) — 给定副本上当前正在运行或最近一次完成的刷新所写入的行数。如果状态为 RunningOnAnotherReplica,则为 NULL
  • written_bytes (Nullable(UInt64)) — 给定副本上当前正在运行或最近一次完成的刷新所写入的字节数。如果状态为 RunningOnAnotherReplica,则为 NULL

示例

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