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

system.processes

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.

该系统表用于实现 SHOW PROCESSLIST 查询。

列:

  • is_initial_query (UInt8) — 指示该查询是直接来自用户,还是在分布式查询执行过程中由 ClickHouse 服务器发起。
  • user (String) — 发出该查询的用户。请注意,在分布式处理场景下,查询会以默认用户身份发送到远程服务器。该字段包含的是此特定查询的用户名,而不是由此查询所发起的其他查询的用户名。
  • query_id (String) — 查询 ID(如果已定义)。
  • address (IPv6) — 发出该查询的 IP 地址。在分布式处理时也是该地址。要跟踪分布式查询最初是从哪里发出的,请查看查询请求方服务器上的 system.processes。
  • port (UInt16) — 执行查询的客户端所使用的端口。
  • initial_user (String) — 执行初始查询的用户名称(用于分布式查询执行)。
  • initial_query_id (String) — 初始查询 ID(用于分布式查询执行)。
  • initial_address (IPv6) — 父查询的发起 IP 地址。
  • initial_port (UInt16) — 发起父查询时客户端使用的端口。
  • interface (UInt8) — 用于发送查询的接口类型。TCP = 1,HTTP = 2,GRPC = 3,MYSQL = 4,POSTGRESQL = 5,LOCAL = 6,TCP_INTERSERVER = 7。
  • os_user (String) — 在操作系统中运行 clickhouse-client 的用户名。
  • client_hostname (String) — 运行 clickhouse-client 或其他 TCP 客户端的客户端所在机器的主机名。
  • client_name (String) — clickhouse-client 或其他 TCP 客户端的名称。
  • client_revision (UInt64) — clickhouse-client 或其他 TCP 客户端的修订号。
  • client_version_major (UInt64) — clickhouse-client 或其他 TCP 客户端的主版本号。
  • client_version_minor (UInt64) — clickhouse-client 或其他 TCP 客户端的次版本号。
  • client_version_patch (UInt64) — ClickHouse 客户端(clickhouse-client)或其他 TCP 客户端版本的补丁号部分。
  • http_method (UInt8) — 发起查询的 HTTP 方法。可能的取值:0 — 查询是从 TCP 接口发起的。1 — 使用 GET 方法。2 — 使用 POST 方法。
  • http_user_agent (String) — 在 HTTP 查询中传递的 HTTP 请求头 User-Agent
  • http_referer (String) — 在 HTTP 请求中传递的 Referer HTTP 头(包含发出该请求的页面的完整或部分地址)。
  • forwarded_for (String) — HTTP 请求中传递的 HTTP 头部字段 X-Forwarded-For。
  • quota_key (String) — 在配额设置中指定的配额键(参见 keyed)。
  • distributed_depth (UInt64) — 查询在服务器各节点之间内部重传的次数。
  • elapsed (Float64) — 从请求开始执行起经过的时间,单位为秒。
  • is_cancelled (UInt8) — 查询是否已被取消。
  • is_all_data_sent (UInt8) — 是否已将所有数据发送给客户端(即查询已在服务器端完成)。
  • read_rows (UInt64) — 从表中读取的行数。对于分布式处理,在发起请求的服务器上,该值是所有远程服务器的总和。
  • read_bytes (UInt64) — 从表中读取的未压缩字节数。对于分布式处理,在发起请求的服务器上,此值是所有远程服务器的总和。
  • total_rows_approx (UInt64) — 需要读取的行数的近似总数。对于分布式处理,在请求端服务器上,该值表示所有远程服务器的总和。在请求处理过程中,当发现新的待处理数据源时,该值可能会被更新。
  • written_rows (UInt64) — 写入到存储的行数。
  • written_bytes (UInt64) — 写入存储的字节数。
  • memory_usage (Int64) — 查询使用的 RAM 内存量。可能不包括某些类型的专用内存
  • peak_memory_usage (Int64) — 当前内存使用量的峰值。
  • query (String) — 查询语句文本。对于 INSERT 语句,不包括要插入的数据。
  • normalized_query_hash (UInt64) — 一个数值型哈希值,对于仅在字面量取值上不同的查询,该值是相同的。
  • query_kind (String) — 查询类型,如 SELECT、INSERT 等。
  • thread_ids (Array(UInt64)) — 所有参与此查询的线程的标识符列表。
  • peak_threads_usage (UInt64) — 执行该查询时并发线程的最大数量。
  • ProfileEventsMap(String, UInt64))— 此查询对应的 ProfileEvents 统计信息。
  • Settings (Map(String, String)) — 已修改的用户级别设置列表。
  • current_database (String) — 当前数据库的名称。
  • is_internal (UInt8) — 表示该查询是否为内部执行的辅助查询。`
SELECT * FROM system.processes LIMIT 10 FORMAT Vertical;
第 1 行:
──────
is_initial_query:     1
user:                 default
query_id:             35a360fa-3743-441d-8e1f-228c938268da
address:              ::ffff:172.23.0.1
port:                 47588
initial_user:         default
initial_query_id:     35a360fa-3743-441d-8e1f-228c938268da
initial_address:      ::ffff:172.23.0.1
initial_port:         47588
interface:            1
os_user:              bharatnc
client_hostname:      tower
client_name:          ClickHouse
client_revision:      54437
client_version_major: 20
client_version_minor: 7
client_version_patch: 2
http_method:          0
http_user_agent:
quota_key:
elapsed:              0.000582537
is_cancelled:         0
is_all_data_sent:     0
read_rows:            0
read_bytes:           0
total_rows_approx:    0
written_rows:         0
written_bytes:        0
memory_usage:         0
peak_memory_usage:    0
query:                SELECT * from system.processes LIMIT 10 FORMAT Vertical;
thread_ids:           [67]
ProfileEvents:        {'Query':1,'SelectQuery':1,'ReadCompressedBytes':36,'CompressedReadBufferBlocks':1,'CompressedReadBufferBytes':10,'IOBufferAllocs':1,'IOBufferAllocBytes':89,'ContextLock':15,'RWLockAcquiredReadLocks':1}
Settings:             {'background_pool_size':'32','load_balancing':'random','allow_suspicious_low_cardinality_types':'1','distributed_aggregation_memory_efficient':'1','skip_unavailable_shards':'1','log_queries':'1','max_bytes_before_external_group_by':'20000000000','max_bytes_before_external_sort':'20000000000','allow_introspection_functions':'1'}

共有 1 行。耗时:0.002 秒。