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

system.query_metric_log

在 ClickHouse Cloud 中查询

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

包含来自表 system.events 的单个查询的内存和指标值的历史记录,定期刷新到磁盘上。

查询开始后,数据会以 query_metric_log_interval 毫秒(默认为 1000)为周期进行收集。如果查询持续时间超过 query_metric_log_interval,则在查询完成时也会收集数据。

列:

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

示例

SELECT * FROM system.query_metric_log LIMIT 1 FORMAT Vertical;
Row 1:
──────
query_id:                                                        97c8ba04-b6d4-4bd7-b13e-6201c5c6e49d
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
memory_usage:                                                    313434219
peak_memory_usage:                                               598951986
ProfileEvent_Query:                                              0
ProfileEvent_SelectQuery:                                        0
ProfileEvent_InsertQuery:                                        0
ProfileEvent_FailedQuery:                                        0
ProfileEvent_FailedSelectQuery:                                  0
...

另请参见