跳到主要内容
跳到主要内容
编辑此页

processors_profile_log

在 ClickHouse Cloud 中查询

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

此表包含处理器级别的性能分析(您可以在EXPLAIN PIPELINE中找到)。

  • hostname (LowCardinality(String)) — 执行查询的服务器的主机名。
  • event_date (Date) — 事件发生的日期。
  • event_time (DateTime) — 事件发生的日期和时间。
  • event_time_microseconds (DateTime64) — 事件发生的日期和时间,精度为微秒。
  • id (UInt64) — 处理器的 ID
  • parent_ids (Array(UInt64)) — 父处理器的 ID 列表
  • plan_step (UInt64) — 创建此处理器的查询计划步骤的 ID。 如果处理器不是从任何步骤添加的,则该值为零。
  • plan_group (UInt64) — 如果处理器是由查询计划步骤创建的,则为处理器的组。 组是对来自同一查询计划步骤添加的处理器进行逻辑分区。 组仅用于美化 EXPLAIN PIPELINE 结果的结果。
  • initial_query_id (String) — 初始查询的 ID(用于分布式查询执行)。
  • query_id (String) — 查询 ID
  • name (LowCardinality(String)) — 处理器的名称。
  • elapsed_us (UInt64) — 此处理器执行的微秒数。
  • input_wait_elapsed_us (UInt64) — 此处理器等待数据(来自其他处理器)的微秒数。
  • output_wait_elapsed_us (UInt64) — 此处理器因输出端口已满而等待的微秒数。
  • input_rows (UInt64) — 处理器消耗的行数。
  • input_bytes (UInt64) — 处理器消耗的字节数。
  • output_rows (UInt64) — 处理器生成的行数。
  • output_bytes (UInt64) — 处理器生成的字节数。 示例

查询

EXPLAIN PIPELINE
SELECT sleep(1)
┌─explain─────────────────────────┐
(Expression)
│ ExpressionTransform │
(SettingQuotaAndLimits)
(ReadFromStorage)
│ SourceFromSingleChunk 01
└─────────────────────────────────┘

SELECT sleep(1)
SETTINGS log_processors_profiles = 1
Query id: feb5ed16-1c24-4227-aa54-78c02b3b27d4
┌─sleep(1)─┐
0
└──────────┘
1 rows in set. Elapsed: 1.018 sec.

SELECT
name,
elapsed_us,
input_wait_elapsed_us,
output_wait_elapsed_us
FROM system.processors_profile_log
WHERE query_id = 'feb5ed16-1c24-4227-aa54-78c02b3b27d4'
ORDER BY name ASC

结果

┌─name────────────────────┬─elapsed_us─┬─input_wait_elapsed_us─┬─output_wait_elapsed_us─┐
│ ExpressionTransform │ 1000497 │ 2823 │ 197 │
│ LazyOutputFormat │ 36 │ 1002188 │ 0 │
│ LimitsCheckingTransform │ 10 │ 1002994 │ 106 │
│ NullSource │ 5 │ 1002074 │ 0 │
│ NullSource │ 1 │ 1002084 │ 0 │
│ SourceFromSingleChunk │ 45 │ 4736 │ 1000819 │
└─────────────────────────┴────────────┴───────────────────────┴────────────────────────┘

在这里您可以看到

  • ExpressionTransform 正在执行 sleep(1) 函数,因此它的 work 将耗时 1e6,因此 elapsed_us > 1e6。
  • SourceFromSingleChunk 需要等待,因为 ExpressionTransform 在执行 sleep(1) 期间不接受任何数据,因此它将处于 PortFull 状态 1e6 微秒,因此 output_wait_elapsed_us > 1e6。
  • LimitsCheckingTransform/NullSource/LazyOutputFormat 需要等待直到 ExpressionTransform 执行 sleep(1) 以处理结果,因此 input_wait_elapsed_us > 1e6。

另请参阅