[go: up one dir, main page]

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

system.metric_log

在 ClickHouse Cloud 中查询

此系统表中的数据在 ClickHouse Cloud 中的每个节点上本地保存。因此,要获得所有数据的完整视图,需要使用 clusterAllReplicas 函数。有关进一步的详细信息,请参见 这里

包含来自 system.metricssystem.events 表的指标值历史,定期刷新到磁盘。

列:

  • hostname (LowCardinality(String)) — 执行查询的服务器主机名。
  • event_date (Date) — 事件日期。
  • event_time (DateTime) — 事件时间。
  • event_time_microseconds (DateTime64) — 带有微秒分辨率的事件时间。

示例

SELECT * FROM system.metric_log LIMIT 1 FORMAT Vertical;
Row 1:
──────
hostname:                                                        clickhouse.eu-central1.internal
event_date:                                                      2020-09-05
event_time:                                                      2020-09-05 16:22:33
event_time_microseconds:                                         2020-09-05 16:22:33.196807
milliseconds:                                                    196
ProfileEvent_Query:                                              0
ProfileEvent_SelectQuery:                                        0
ProfileEvent_InsertQuery:                                        0
ProfileEvent_FailedQuery:                                        0
ProfileEvent_FailedSelectQuery:                                  0
...
...
CurrentMetric_Revision:                                          54439
CurrentMetric_VersionInteger:                                    20009001
CurrentMetric_RWLockWaitingReaders:                              0
CurrentMetric_RWLockWaitingWriters:                              0
CurrentMetric_RWLockActiveReaders:                               0
CurrentMetric_RWLockActiveWriters:                               0
CurrentMetric_GlobalThread:                                      74
CurrentMetric_GlobalThreadActive:                                26
CurrentMetric_LocalThread:                                       0
CurrentMetric_LocalThreadActive:                                 0
CurrentMetric_DistributedFilesToInsert:                          0

模式 该表可以使用 XML 标签 <schema_type> 配置为不同的模式类型。默认模式类型为 wide,其中每个指标或配置事件作为单独的列存储。该模式对于单列读取是最优和高效的。

transposed 模式以类似于 system.asynchronous_metric_log 的格式存储数据,其中指标和事件作为行存储。由于减少了合并期间的资源消耗,该模式对于低资源设置非常有用。

还存在兼容性模式 transposed_with_wide_view,它在具有转置模式的表(system.transposed_metric_log)中存储实际数据,并在其上使用宽模式创建视图。该视图查询转置表,使其在从 wide 模式迁移到 transposed 模式时非常有用。

另见