跳到主要内容
跳到主要内容

system.disks

Querying in ClickHouse Cloud

The data in this system table is held locally on each node in ClickHouse Cloud. Obtaining a complete view of all data, therefore, requires the clusterAllReplicas function. See here for further details.

包含有关在服务器配置中定义的磁盘的信息。

列:

  • name (String) — 服务器配置中磁盘的名称。
  • path (String) — 文件系统中挂载点的路径。
  • free_space (UInt64) — 磁盘上的空闲空间(字节数)。
  • total_space (UInt64) — 磁盘容量(字节数)。
  • unreserved_space (UInt64) — 未被预留占用的空闲空间(free_space 减去当前运行的合并、插入以及其他磁盘写入操作所占用的预留空间大小)。
  • keep_free_space (UInt64) — 需要在磁盘上保持空闲的空间量(字节数)。在磁盘配置的 keep_free_space_bytes 参数中定义。
  • type (String) — 磁盘类型,用于指示该磁盘将数据存储在何处——RAM、本地磁盘或远程存储。
  • object_storage_type (String) — 若磁盘类型为 object_storage,则表示对象存储的类型。
  • metadata_type (String) — 若磁盘类型为 object_storage,则表示元数据存储的类型。
  • is_encrypted (UInt8) — 标志位,用于指示该磁盘是否对底层数据进行加密。
  • is_read_only (UInt8) — 标志位,用于指示该磁盘是否只能执行读取操作。
  • is_write_once (UInt8) — 标志位,用于指示该磁盘是否为一次写入(write-once)。这意味着它支持对该磁盘执行 BACKUP,但不支持向该磁盘上的 MergeTree 表执行 INSERT
  • is_remote (UInt8) — 标志位,用于指示对该磁盘的操作是否涉及网络交互。
  • is_broken (UInt8) — 标志位,用于指示该磁盘是否已损坏。损坏的磁盘其空间为 0,且无法使用。
  • cache_path (String) — 当磁盘支持缓存时,本地磁盘上的缓存目录路径。

示例

SELECT * FROM system.disks;
┌─name────┬─path─────────────────┬───free_space─┬──total_space─┬─keep_free_space─┐
│ default │ /var/lib/clickhouse/ │ 276392587264 │ 490652508160 │               0 │
└─────────┴──────────────────────┴──────────────┴──────────────┴─────────────────┘

返回 1 行。耗时: 0.001 秒。