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

system.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)) — 上级处理器的 IDs。
  • 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 0 → 1 │
└─────────────────────────────────┘

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。

参见