在众多的System系统表中,关于ClickHouse的运行指标查询,主要来自metrics、events和asynchronous_metrics。
- metrics
包括可以立即计算或具有当前值的指标。例如,同时处理的查询数或当前副本延迟。该表始终是最新的。
SELECT * FROM system.metrics LIMIT 10;
┌─metric─────────────────────┬─value─┬─description────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Query │ 1 │ Number of executing queries │
│ Merge │ 0 │ Number of executing background merges │
│ PartMutation │ 0 │ Number of mutations (ALTER DELETE/UPDATE) │
│ ReplicatedFetch │ 0 │ Number of data parts being fetched from replica │
│ ReplicatedSend │ 0 │ Number of data parts being sent to replicas │
│ ReplicatedChecks │ 0 │ Number of data parts checking for consistency │
│ BackgroundPoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches, or replication queue bookkeeping) │
│ BackgroundMovePoolTask │ 0 │ Number of active tasks in BackgroundProcessingPool for moves │
│ BackgroundSchedulePoolTask │ 0 │ Number of active tasks in BackgroundSchedulePool. This pool is used for periodic ReplicatedMergeTree tasks, like cleaning old data parts, altering data parts, replica re-initialization, etc. │
│ DiskSpaceReservedForMerge │ 0 │ Disk space reserved for currently running background merges. It is slightly more than the total size of currently merging parts. │
└────────────────────────────┴───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
10 rows in set. Elapsed: 0.003 sec.
列:
metric(String) 指标名称
value(Int64) 指标值
description(String) 指标描述
12.events
主要包括系统中发生的事件数的信息。例如,在表中,可以找到SELECT自ClickHouse服务器启动以来已处理的查询数量。
SELECT * FROM system.events LIMIT 2, 4
Row 1:
──────
event: FileOpen
value: 150186
description: Number of files opened.
Row 2:
──────
event: Seek
value: 4288
description: Number of times the 'lseek' function was called.
Row 3:
──────
event: ReadBufferFromFileDescriptorRead
value: 147516
description: Number of reads (read/pread) from a file descriptor. Does not include sockets.
Row 4:
──────
event: ReadBufferFromFileDescriptorReadBytes
value: 5950781368
description: Number of bytes read from file descriptors. If the file is compressed, this will show the compressed data size.
4 rows in set. Elapsed: 0.004 sec.
列:
event(String) 事件名称
value(UInt64) 发生的事件数
description(String) 事件描述
13.asynchronous_metrics
包含在后台定期计算的指标。例如,正在使用的RAM数量。
SELECT * FROM system.asynchronous_metrics LIMIT 10;
┌─metric───────────────────────┬───value─┐
│ MarkCacheBytes │ 1006592 │
│ Uptime │ 5240 │
│ UncompressedCacheCells │ 0 │
│ MarkCacheFiles │ 290 │
│ ReplicasSumInsertsInQueue │ 0 │
│ ReplicasMaxAbsoluteDelay │ 0 │
│ UncompressedCacheBytes │ 0 │
│ ReplicasSumMergesInQueue │ 0 │
│ CompiledExpressionCacheCount │ 0 │
│ ReplicasMaxQueueSize │ 0 │
└──────────────────────────────┴─────────┘
列:
metric(String) 指标名称
value(Float64) 指标值
上篇文章Clickhouse - System Tables 集合(一)中只介绍了查询日志中的1种类型(query_log),下面将其他5种类型记录的ClickHouse操作行为简单介绍。
14.query_thread_log
有关执行查询的线程的信息。例如,线程名称,线程开始时间,查询处理的持续时间。
vim /etc/clickhouse-server/config.xml
<query_thread_log>
<database>system</database>
<table>query_thread_log</table>
<partition_by>toYYYYMM(event_date)</partition_by>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
</query_thread_log>
vim /etc/clickhouse-server/users.xml
<log_queries>1</log_queries>
SELECT * FROM system.query_thread_log LIMIT 1 \G
Row 1:
──────
event_date: 2021-04-07
event_time: 2021-04-07 09:19:17
query_start_time: 2021-04-07 09:19:17
query_duration_ms: 5
read_rows: 0
read_bytes: 0
written_rows: 0
written_bytes: 0
memory_usage: 248
peak_memory_usage: 248
thread_name: AsyncBlockInput
thread_number: 57
os_thread_id: 16035
master_thread_number: 76
master_os_thread_id: 16060
query: SELECT * FROM system.query_log
is_initial_query: 1
user: default
query_id: 61720a95-c6d4-43d1-bbbc-4c4f9de1ca54
address: ::ffff:127.0.0.1
port: 5404
initial_user: default
initial_query_id: 61720a95-c6d4-43d1-bbbc-4c4f9de1ca54
initial_address: ::ffff:127.0.0.1
initial_port: 5404
interface: 1
os_user: root
client_hostname: worker1
client_name: ClickHouse client
client_revision: 54432
client_version_major: 20
client_version_minor: 2
client_version_patch: 1
http_method: 0
http_user_agent:
quota_key:
revision: 54432
ProfileEvents.Names: ['ContextLock','RealTimeMicroseconds','UserTimeMicroseconds','SoftPageFaults','OSCPUWaitMicroseconds','OSCPUVirtualTimeMicroseconds']
ProfileEvents.Values: [1,5480,193,14,2,148]
1 rows in set. Elapsed: 0.035 sec.
列:
event_date(Date) 线程完成查询执行的日期
event_time(DateTime) 线程完成查询执行的日期和时间
event_time_microsecinds(DateTime) 线程以微秒为单位完成查询执行的日期和时间
query_start_time(DateTime) 查询执行的开始时间
query_start_time_microseconds(DateTime64) 查询执行的开始时间,以微秒为单位
query_duration_ms(UInt64) 查询执行的持续时间
read_rows(UInt64) 读取的行数
read_bytes(UInt64) 读取的字节数
written_rows(UInt64) 对于INSERT查询,是已写入的行数。对于其他查询,列值为0
written_bytes(UInt64) 对于INSERT查询,为写入字节数。对于其他查询,列值为0
memory_usage(Int64) 在此线程的上下文中分配的内存和释放的内存之间的差
peak_memory_usage(Int64) 在此线程的上下文中分配的内存和已释放的内存之间的最大差异
thread_name(String) 线程的名称
thread_number(UInt32) 内部线程ID
thread_id(Int32) 线程ID
master_thread_id(UInt64) 初始线程的OS初始ID
query(String) 查询字符
is_initial_query(UInt8) 查询类型
1 查询是由客户端发起的
0 由另一个查询启动查询以执行分布式查询
user(String) 发起当前查询的用户的名称
query_id(String) 查询的ID
address(IPv6) 用于进行查询的IP地址
port(UInt16) 用于进行查询的客户端端口
initial_user(String) 运行初始查询(用于分布式查询执行)的用户名
initial_query_id(String) 初始查询的ID(用于分布式查询执行)
initial_address(IPv6) 从其启动父查询的IP地址
initial_port(UInt16) 用于进行父查询的客户端端口
interface(UInt8) 从中启动查询的接口
1-TCP
2-HTTP
os_user(字符串) 运行clickhouse-client的操作系统用户名
client_hostname(String) 运行clickhouse-client或另一个TCP客户端的客户端计算机的主机名
client_name(String) Clickhouse-client或另一个TCP客户端名称
client_revision(UInt32) 修改clickhouse客户端或另一个TCP客户端
client_version_major(UInt32) Clickhouse客户端或另一个TCP客户端的主要版本
client_version_minor(UInt32) Clickhouse客户端或另一个TCP客户端的次要版本
client_version_patch(UInt32) Clickhouse客户端或其他TCP客户端版本的修补程序组件
http_method(UInt8)-启动查询的HTTP方法
0 查询是从TCP接口启动的
1 GET使用方法
2 POST使用方法
http_user_agent(String) UserAgentHTTP请求中传递的标头
quota_key(String) 在配额设置中指定的“ quota键” (请参阅keyed)
revision(UInt32) ClickHouse版本
ProfileEvents.Names(Array(String)) 计数器,用于为此线程测量不同的指标。可以在表system.events中找到它们的描述
ProfileEvents.Values(Array(UInt64)) ProfileEvents.Names列中列出的该线程的指标值
15.part_log
当指定part_log服务器设置时,才创建该表。包含有关与发生的事件的信息数据部分在MergeTree家族表,如添加或合并数据。
该system.part_log表是在第一次向MergeTree表中插入数据之后创建的。
SELECT * FROM system.part_log LIMIT 1 FORMAT Vertical;
Row 1:
──────
query_id: 983ad9c7-28d5-4ae1-844e-603116b7de31
event_type: NewPart
event_date: 2021-02-02
event_time: 2021-02-02 11:14:28
event_time_microseconds: 2021-02-02 11:14:28.861919
duration_ms: 35
database: default
table: log_mt_2
part_name: all_1_1_0
partition_id: all
path_on_disk: db/data/default/log_mt_2/all_1_1_0/
rows: 115418
size_in_bytes: 1074311
merged_from: []
bytes_uncompressed: 0
read_rows: 0
read_bytes: 0
peak_memory_usage: 0
error: 0
列:
query_id(String) INSERT创建此数据部分的查询的标识符
event_type(Enum8) 数据部分发生的事件的类型。可以具有以下值之一:
NEW_PART 插入新的数据部分
MERGE_PARTS 合并数据部分
DOWNLOAD_PART 下载数据部分
REMOVE_PART 使用DETACH PARTITION删除或分离数据部分
MUTATE_PART 更改数据部分
MOVE_PART 将数据部分从一个磁盘移动到另一磁盘
event_date(日期) 活动日期
event_time(DateTime) 事件时间
event_time_microseconds(DateTime64) 事件时间,以微秒为单位。
duration_ms(UInt64) 持续时间
database(字符串) 数据部分所在的数据库的名称
table(String) 数据部分所在的表的名称
part_name(String) 数据部分的名称
partition_id(String) 数据部分插入到的分区的ID。all如果分区是通过,则该列将使用值tuple()
path_on_disk(String) 包含数据零件文件的文件夹的绝对路径
rows(UInt64) 数据部分中的行数
size_in_bytes(UInt64) 数据部分的大小,以字节为单位
merged_from(Array(String)) 由组成当前零件的零件的名称组成的数组(合并后)
bytes_uncompressed(UInt64) 未压缩字节的大小
read_rows(UInt64) 合并期间读取的行数
read_bytes(UInt64) 合并期间读取的字节数
peak_memory_usage(Int64) 在此线程的上下文中分配的内存和已释放的内存之间的最大差异
error(UInt16) 发生的错误的代码号
exception(String) 发生错误的文本消息
16.text_log
日志记录条目,包括INFO,DEBUG,Trace。
开启方式:
vim /etc/clickhouse-server/config.xml
<text_log>
<database>system</database>
<table>text_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
</text_log>
SELECT * FROM system.text_log LIMIT 1 \G
Row 1:
──────
event_date: 2020-09-10
event_time: 2020-09-10 11:23:07
event_time_microseconds: 2020-09-10 11:23:07.871397
microseconds: 871397
thread_name: clickhouse-serv
thread_id: 564917
level: Information
query_id:
logger_name: DNSCacheUpdater
message: Update period 15 seconds
revision: 54440
source_file: /ClickHouse/src/Interpreters/DNSCacheUpdater.cpp; void DB::DNSCacheUpdater::start()
source_line: 45
列:
event_date (日期) 输入日期
event_time (DateTime) 输入时间
event_time_microseconds (DateTime) 输入时间,以微秒为单位
microseconds (UInt32) 条目的微秒
thread_name (字符串) 从中完成日志记录的线程的名称
thread_id (UInt64) 操作系统线程ID
level(Enum8) 入门级
1或'Fatal'
2或'Critical'
3或'Error'
4或'Warning'
5或'Notice'
6或'Information'
7或'Debug'
8或'Trace'
query_id (字符串) 查询的ID
logger_name(LowCardinality(String)) 记录器的名称(即 DDLWorker)
message (字符串) 消息本身
revision (UInt32) ClickHouse修订版
source_file (LowCardinality(String)) 从中完成日志记录的源文件
source_line (UInt64) 从中完成日志记录的源代码行
17.metric_log
包含来自表system.metrics和的指标值的历史记录,并system.events定期刷新到磁盘。
开启方式:
vim /etc/clickhouse-server/config.xml
<metric_log>
<database>system</database>
<table>metric_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<collect_interval_milliseconds>1000</collect_interval_milliseconds>
<!--
collect_interval_milliseconds表示收集metrics和events数据的时间周期。
-->
</metric_log>
下面再介绍一些常用查询相关的系统表。
18.tables
数据库中每个表的元数据。该system.tables表用于SHOW TABLES查询实现。
SELECT * FROM system.tables LIMIT 2 FORMAT Vertical;
Row 1:
──────
database: default
name: .inner.trans_log_view
engine: MergeTree
is_temporary: 0
data_paths: ['/var/lib/clickhouse/data/default/%2Einner%2Etrans_log_view/']
metadata_path: /var/lib/clickhouse/metadata/default/%2Einner%2Etrans_log_view.sql
metadata_modification_time: 2021-03-16 16:54:46
dependencies_database: []
dependencies_table: []
create_table_query: CREATE TABLE default.`.inner.trans_log_view` (`actiontime` DateTime, `actioncode` Enum16('请求' = 1000, '发银行' = 1090, '银行响应' = 1100, '给客票通知' = 1180, '给客票回执' = 1200), `bankid` Enum8('微信支付' = 1, '支付宝' = 2, '中国银联' = 3, '中铁银通卡' = 4, '工商银行' = 5, '农业银行' = 6, '中国银行' = 7, '建设银行' = 8, '招商银行' = 9, '邮储银行' = 10, '第三方支付' = 11), `channelid` Enum8('互联网订票' = 1, 'POS' = 2, 'TVM' = 3, '电话订票' = 4, '手机订票' = 5, '扫码订票' = 6, '闸机' = 7, '卡务' = 8, '人工订票' = 9, '通知退款' = 10, 'E卡通' = 11), `transtypeid` Enum8('无状态' = 0, '正常支付' = 1, '退票' = 2, '冲正' = 3, '撤销' = 4, '查询' = 5, 'B2C退款' = 6, '冲正退款' = 7, '线上退款' = 8, '受理单退款' = 9, '偏差退款' = 10, '特办退款' = 11, '线下试退款' = 12, '主动扫码' = 13), `center` Enum8('一中心' = 1, '二中心' = 2), `ishb` Enum8('普通订单' = 0, '候补订单' = 1), `transstatus` Enum8('成功' = 0, '失败' = 1), `transamount` AggregateFunction(sum, UInt32), `cnt` AggregateFunction(sum, UInt8)) ENGINE = MergeTree() PARTITION BY toYYYYMMDD(actiontime) ORDER BY (intHash64(actiontime), actioncode, bankid, channelid, transtypeid, center, ishb, transstatus) SAMPLE BY intHash64(actiontime) SETTINGS index_granularity = 8192
engine_full: MergeTree() PARTITION BY toYYYYMMDD(actiontime) ORDER BY (intHash64(actiontime), actioncode, bankid, channelid, transtypeid, center, ishb, transstatus) SAMPLE BY intHash64(actiontime) SETTINGS index_granularity = 8192
partition_key: toYYYYMMDD(actiontime)
sorting_key: intHash64(actiontime), actioncode, bankid, channelid, transtypeid, center, ishb, transstatus
primary_key: intHash64(actiontime), actioncode, bankid, channelid, transtypeid, center, ishb, transstatus
sampling_key: intHash64(actiontime)
storage_policy: default
Row 2:
──────
database: default
name: .inner.trans_log_view_new
engine: MergeTree
is_temporary: 0
data_paths: ['/var/lib/clickhouse/data/default/%2Einner%2Etrans_log_view_new/']
metadata_path: /var/lib/clickhouse/metadata/default/%2Einner%2Etrans_log_view_new.sql
metadata_modification_time: 2021-03-16 16:52:40
dependencies_database: []
dependencies_table: []
create_table_query: CREATE TABLE default.`.inner.trans_log_view_new` (`transamount` AggregateFunction(sum, UInt32), `cnt` AggregateFunction(sum, UInt8), `appreqtime` DateTime, `bankid` UInt32, `channelid` UInt8, `actioncode` UInt16, `center` UInt8, `ishb` String, `resultcode` UInt8, `transstatus` UInt8, `transtypeid` UInt8) ENGINE = MergeTree() PARTITION BY toYYYYMMDD(appreqtime) ORDER BY (intHash64(appreqtime), bankid, channelid, actioncode, center, ishb, resultcode, transstatus, transtypeid) SAMPLE BY intHash64(appreqtime) SETTINGS index_granularity = 8192
engine_full: MergeTree() PARTITION BY toYYYYMMDD(appreqtime) ORDER BY (intHash64(appreqtime), bankid, channelid, actioncode, center, ishb, resultcode, transstatus, transtypeid) SAMPLE BY intHash64(appreqtime) SETTINGS index_granularity = 8192
partition_key: toYYYYMMDD(appreqtime)
sorting_key: intHash64(appreqtime), bankid, channelid, actioncode, center, ishb, resultcode, transstatus, transtypeid
primary_key: intHash64(appreqtime), bankid, channelid, actioncode, center, ishb, resultcode, transstatus, transtypeid
sampling_key: intHash64(appreqtime)
storage_policy: default
2 rows in set. Elapsed: 0.006 sec.
列:
database (字符串) 表所在的数据库的名称
name (字符串) 表名
engine (字符串) 表引擎名称(不带参数)
is_temporary (UInt8) 指示表是否为临时的标志
data_path (字符串) 文件系统中表数据的路径
metadata_path (字符串) 文件系统中表元数据的路径
metadata_modification_time (DateTime) 表元数据的最新修改时间
dependencies_database (数组(字符串)) 数据库依赖项
dependencies_table(数组(字符串)) 表依赖关系(基于当前表的MaterializedView表)
create_table_query (字符串) 用于创建表的查询
engine_full (字符串) 表引擎的参数
partition_key (字符串) 表中指定的分区键表达式
sorting_key (字符串) 表中指定的排序键表达式
primary_key (字符串) 表中指定的主键表达式
sampling_key (字符串) 表中指定的采样键表达式
storage_policy (字符串) 存储策略:
合并树
分散式
total_rows(Nullable(UInt64)) 行总数,如果可以快速确定表中的确切行数,否则Null(包括底层Buffer表)
total_bytes(Nullable(UInt64)) 字节总数,如果可以快速确定存储表的确切字节数,否则Null(不包括任何基础存储)
如果表将数据存储在磁盘上,则返回磁盘上已使用的空间(即压缩的空间)
如果表将数据存储在内存中,则返回内存中已用字节的近似数量
lifetime_rows(Nullable(UInt64)) 自服务器启动以来已插入的总行数(仅适用于Buffer表)
lifetime_bytes(Nullable(UInt64)) 自服务器启动以来已插入的总字节数(仅适用于Buffer表)
19.part_log
此表包含有关发生的事件的数据部分在MergeTree家族表,如添加或合并数据。
SELECT * FROM system.part_log LIMIT 1 FORMAT Vertical;
Row 1:
──────
query_id: 983ad9c7-28d5-4ae1-844e-603116b7de31
event_type: NewPart
event_date: 2021-02-02
event_time: 2021-02-02 11:14:28
event_time_microseconds: 2021-02-02 11:14:28.861919
duration_ms: 35
database: default
table: log_mt_2
part_name: all_1_1_0
partition_id: all
path_on_disk: db/data/default/log_mt_2/all_1_1_0/
rows: 115418
size_in_bytes: 1074311
merged_from: []
bytes_uncompressed: 0
read_rows: 0
read_bytes: 0
peak_memory_usage: 0
error: 0
exception:
列:
query_id(字符串) 标识符INSERT创建此数据部分查询
event_type(Enum8) 数据部分发生的事件的类型。可以具有以下值之一:
NEW_PART 插入新的数据部分
MERGE_PARTS 合并数据部分
DOWNLOAD_PART 下载数据部分
REMOVE_PART 使用DETACH PARTITION删除或分离数据部分
MUTATE_PART 更改数据部分
MOVE_PART 将数据部分从一个磁盘移动到另一磁盘
event_date(日期) 活动日期
event_time(DateTime) 事件时间
event_time_microseconds(DateTime64) 事件时间,以微秒为单位
duration_ms(UInt64) 持续时间
database(字符串) 数据库中的数据部分中的名称
table(String) 数据部分所在的表的名称
part_name(String) 数据部分的名称
partition_id(String) 数据部分插入到的分区的ID。all如果分区是通过,则该列将使用值tuple()
path_on_disk(String) 包含数据零件文件的文件夹的绝对路径
rows(UInt64) 数据部分中的行数
size_in_bytes(UInt64) 数据部分的大小,以字节为单位
merged_from(阵列(字符串)) 其中电流部分,由(后合并)构成的部件的名称的数组
bytes_uncompressed(UInt64) 未压缩字节的大小
read_rows(UInt64) 合并期间读取的行数
read_bytes(UInt64) 合并期间读取的字节数
peak_memory_usage(Int64) 在此线程的上下文中分配的内存和已释放的内存之间的最大差异
error(UInt16) 发生的错误的代码号
exception(String) 发生错误的文本消息
该system.part_log表是在第一次向MergeTree表中插入数据之后创建的。
20.numbers
该表包含一个名为UInt64的列number,该列包含几乎所有从零开始的自然数。可以使用此表进行测试。
从该表读取的数据不会并行化。
SELECT * FROM system.numbers LIMIT 10;
┌─number─┐
│ 0 │
│ 1 │
│ 2 │
│ 3 │
│ 4 │
│ 5 │
│ 6 │
│ 7 │
│ 8 │
│ 9 │
└────────┘
10 rows in set. Elapsed: 0.002 sec.
numbers_mt
与system.numbers相同,但读取是并行的。可按任何顺序返回数字。主要用于测试。
SELECT * FROM system.numbers_mt LIMIT 10;
┌─number─┐
│ 0 │
│ 1 │
│ 2 │
│ 3 │
│ 4 │
│ 5 │
│ 6 │
│ 7 │
│ 8 │
│ 9 │
└────────┘
10 rows in set. Elapsed: 0.002 sec.
21.parts
包含有关MergeTree表各部分的信息。每一行描述一个数据部分。
SELECT * FROM system.parts LIMIT 1 FORMAT Vertical;
SELECT *
FROM system.parts
LIMIT 1
FORMAT Vertical
Row 1:
──────
partition: 20210315
name: 20210315_1_1_0
active: 1
marks: 70
rows: 560858
bytes_on_disk: 3692596
data_compressed_bytes: 3674658
data_uncompressed_bytes: 15704024
marks_bytes: 16800
modification_time: 2021-03-17 18:10:45
remove_time: 0000-00-00 00:00:00
refcount: 1
min_date: 0000-00-00
max_date: 0000-00-00
min_time: 2021-03-15 00:00:00
max_time: 2021-03-15 23:59:00
partition_id: 20210315
min_block_number: 1
max_block_number: 1
level: 0
data_version: 1
primary_key_bytes_in_memory: 1120
primary_key_bytes_in_memory_allocated: 2048
is_frozen: 0
database: default
table: .inner.trans_log_view
engine: MergeTree
disk_name: default
path: /var/lib/clickhouse/data/default/%2Einner%2Etrans_log_view/20210315_1_1_0/
hash_of_all_files: b85c4ff6c8f86222130e864422c44755
hash_of_uncompressed_files: fff5eead0518934ffdae8c3ce8d6c8ae
uncompressed_hash_of_compressed_files: a54a7ffc2e2a158f44d2cdb23959b0b4
1 rows in set. Elapsed: 0.012 sec.
列:
partition(字符串) 分区名称
格式:
YYYYMM 用于按月自动分区
any_string 手动分区时
name(字符串) 数据部分的名称
part_type(String) 数据部分的存储格式
数据存储格式由MergeTree表的min_bytes_for_wide_part和min_rows_for_wide_part设置控制
Wide 每列存储在文件系统中的单独文件中
Compact 所有列都存储在文件系统中的一个文件中
active(UInt8) 指示数据部分是否处于活动状态的标志。如果数据部分处于活动状态,则会在表中使用它。否则,将其删除。合并后,不活动的数据部分仍然保留
marks(UInt64) 标记数。要获得数据部分中的大约行数
rows(UInt64) 行数
bytes_on_disk(UInt64) 所有数据部分文件的总大小(以字节为单位)
data_compressed_bytes(UInt64) 数据部分中压缩数据的总大小。不包括所有辅助文件(例如,带标记的文件)
data_uncompressed_bytes(UInt64) 数据部分中未压缩数据的总大小。不包括所有辅助文件(例如,带标记的文件)
marks_bytes(UInt64) 带标记的文件的大小
modification_time(DateTime) 包含数据部分的目录被修改的时间。这通常对应于数据零件创建的时间
remove_time(DateTime) 数据部分变为非活动状态的时间
refcount(UInt32) 使用数据部分的位置数。大于2的值表示在查询或合并中使用了数据部分
min_date(日期) 数据部分中日期键的最小值
max_date(日期) 数据部分中日期键的最大值
min_time(DateTime) 数据部分中日期和时间键的最小值
max_time(DateTime) 数据部分中日期和时间键的最大值。
partition_id(字符串) 分区的ID
min_block_number(UInt64) 合并后组成当前部分的数据部分的最小数量
max_block_number(UInt64) 合并后组成当前部分的最大数据部分数
level(UInt32) 合并树的深度。零表示当前零件是通过插入而不是通过合并其他零件来创建的
data_version(UInt64) 用于确定应将哪些突变应用于数据部分(版本高于的突变data_version)的编号
primary_key_bytes_in_memory(UInt64)主键值使用的内存量(以字节为单位)
primary_key_bytes_in_memory_allocated(UInt64) 为主键值保留的内存量(以字节为单位)
is_frozen(UInt8) 显示分区数据备份存在的标志
1,备份存在
0,备份不存在
database(字符串) 数据库的名称
table(字符串) 表的名称
engine(字符串) 不带参数的表引擎的名称
path(字符串) 包含数据零件文件的文件夹的绝对路径
disk(字符串) 存储数据部分的磁盘的名称
hash_of_all_files(字符串) 压缩文件的sipHash128
hash_of_uncompressed_files(String) 未压缩文件(带有标记的文件,索引文件等)的sipHash128
uncompressed_hash_of_compressed_files(String) 压缩文件中的数据的sipHash128,就好像它们是未压缩的一样
delete_ttl_info_min(DateTime) TTL DELETE规则的日期和时间键的最小值
delete_ttl_info_max(DateTime) TTL DELETE规则的日期和时间键的最大值
move_ttl_info.expression(Array(String)) 表达式数组。每个表达式定义一个TTL MOVE规则
警告
该move_ttl_info.expression阵列主要是为保持向后兼容性,现在检查simpliest办法TTL MOVE规则是使用move_ttl_info.min和move_ttl_info.max领域。
move_ttl_info.min(Array(DateTime)) 日期和时间值的数组。每个元素都描述了TTL MOVE规则的最小键值
move_ttl_info.max(Array(DateTime)) 日期和时间值的数组。每个元素都描述了TTL MOVE规则的最大键值
bytes(UInt64) 别名bytes_on_disk
marks_size(UInt64) 别名marks_bytes
22.processes
该系统表用于实现SHOW PROCESSLIST查询。
SELECT * FROM system.processes LIMIT 1 FORMAT Vertical;
Row 1:
──────
is_initial_query: 1
user: default
query_id: 26b8cf3d-e151-4eb6-aa39-fd4a7182cbf9
address: ::ffff:127.0.0.1
port: 21762
initial_user: default
initial_query_id: 26b8cf3d-e151-4eb6-aa39-fd4a7182cbf9
initial_address: ::ffff:127.0.0.1
initial_port: 21762
interface: 1
os_user: root
client_hostname: worker1
client_name: ClickHouse client
client_revision: 54432
client_version_major: 20
client_version_minor: 2
client_version_patch: 1
http_method: 0
http_user_agent:
quota_key:
elapsed: 0.00079365
is_cancelled: 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_numbers: [79]
os_thread_ids: [25164]
ProfileEvents.Names: ['Query','SelectQuery','ReadCompressedBytes','CompressedReadBufferBlocks','CompressedReadBufferBytes','IOBufferAllocs','IOBufferAllocBytes','ContextLock','RWLockAcquiredReadLocks']
ProfileEvents.Values: [1,1,36,1,10,1,89,10,1]
Settings.Names: ['use_uncompressed_cache','load_balancing','log_queries','max_memory_usage']
Settings.Values: ['0','random','1','10000000000']
1 rows in set. Elapsed: 0.004 sec.
列:
user(字符串) 进行查询的用户。请记住,对于分布式处理,查询将发送到default用户下的远程服务器。该字段包含特定查询的用户名,而不是此查询启动的查询的用户名
address(字符串) 发出请求的IP地址。分布式处理也是如此。若要跟踪最初来自何处的分布式查询,请在system.processes查询请求者服务器上查看
elapsed (Float64) 自请求开始执行以来的时间(以秒为单位)
rows_read(UInt64) 从表中读取的行数。对于分布式处理,在请求者服务器上,这是所有远程服务器的总数
bytes_read(UInt64) 从表中读取的未压缩字节数。对于分布式处理,在请求者服务器上,这是所有远程服务器的总数
total_rows_approx(UInt64) 应该读取的总行数的近似值。对于分布式处理,在请求者服务器上,这是所有远程服务器的总数。当已知要处理的新资源时,可以在请求处理期间对其进行更新
memory_usage(UInt64) 请求使用的RAM量。它可能不包括某些类型的专用内存
query(字符串) 查询文本。对于INSERT,它不包含要插入的数据
query_id (字符串) 查询ID(如果已定义)
23.settings
当前用户的会话设置的信息。
SELECT * FROM system.settings WHERE name LIKE '%min_i%'\G
SELECT *
FROM system.settings
WHERE name LIKE '%min_i%'
Row 1:
──────
name: min_insert_block_size_rows
value: 1048576
changed: 0
description: Squash blocks passed to INSERT query to specified size in rows, if blocks are not big enough.
min: ᴺᵁᴸᴸ
max: ᴺᵁᴸᴸ
readonly: 0
Row 2:
──────
name: min_insert_block_size_bytes
value: 268435456
changed: 0
description: Squash blocks passed to INSERT query to specified size in bytes, if blocks are not big enough.
min: ᴺᵁᴸᴸ
max: ᴺᵁᴸᴸ
readonly: 0
Row 3:
──────
name: read_backoff_min_interval_between_events_ms
value: 1000
changed: 0
description: Settings to reduce the number of threads in case of slow reads. Do not pay attention to the event, if the previous one has passed less than a certain amount of time.
min: ᴺᵁᴸᴸ
max: ᴺᵁᴸᴸ
readonly: 0
3 rows in set. Elapsed: 0.002 sec.
列:
name(String) 设置名称
value(String) 设置值
changed(UInt8) 显示设置是否从其默认值更改
description(String) 简短的设置说明
min(Nullable(String)) 设置的最小值(如果有的话)是通过constraints设置的。如果设置没有最小值,则包含NULL
max(Nullable(String)) 设置的最大值(如果有的话)是通过constraints设置的。如果设置没有最大值,则包含NULL
readonly(UInt8) 显示当前用户是否可以更改设置:
0 当前用户可以更改设置
1 当前用户无法更改设置
24.table_engines
包含服务器支持的表引擎的描述及其功能支持信息。
SELECT name FROM system.table_engines limit 15,10;
┌─name───────────────────────────────────┐
│ ReplicatedVersionedCollapsingMergeTree │
│ ReplacingMergeTree │
│ ReplicatedSummingMergeTree │
│ ReplicatedAggregatingMergeTree │
│ ReplicatedCollapsingMergeTree │
│ File │
│ ReplicatedGraphiteMergeTree │
│ ReplicatedMergeTree │
│ ReplicatedReplacingMergeTree │
│ VersionedCollapsingMergeTree │
└────────────────────────────────────────┘
10 rows in set. Elapsed: 0.002 sec.
列:
name (字符串) 表引擎的名称
supports_settings(UInt8) 指示表引擎是否支持SETTINGS子句的标志
supports_skipping_indices(UInt8) 指示表引擎是否支持跳过索引的标志
supports_ttl(UInt8) 指示表引擎是否支持TTL的标志
supports_sort_order(UINT8) 标志,表示如果表引擎支持条款PARTITION_BY,PRIMARY_KEY,ORDER_BY和SAMPLE_BY
supports_replication(UInt8) 指示表引擎是否支持数据复制的标志
supports_duduplication (UInt8) 指示表引擎是否支持重复数据删除的标志
supports_parallel_insert(UInt8) 指示表引擎是否支持并行插入的标志
25.merge_tree_settings
包含有关MergeTree表设置的信息。
SELECT * FROM system.merge_tree_settings LIMIT 4 FORMAT Vertical;
Row 1:
──────
name: index_granularity
value: 8192
changed: 0
description: How many rows correspond to one primary key value.
Row 2:
──────
name: merge_max_block_size
value: 8192
changed: 0
description: How many rows in blocks should be formed for merge operations.
Row 3:
──────
name: max_bytes_to_merge_at_max_space_in_pool
value: 161061273600
changed: 0
description: Maximum in total size of parts to merge, when there are maximum free threads in background pool (or entries in replication queue).
Row 4:
──────
name: max_bytes_to_merge_at_min_space_in_pool
value: 1048576
changed: 0
description: Maximum in total size of parts to merge, when there are minimum free threads in background pool (or entries in replication queue).
4 rows in set. Elapsed: 0.002 sec.
列:
name (字符串) 设置名称
value (字符串) 设置值
description (字符串) 设置说明
type (字符串) 设置类型(实现特定的字符串值)
changed (UInt8) 在配置中显式定义还是显式更改了设置
26.functions
有关正常函数和聚合函数的信息。
SELECT * FROM system.functions LIMIT 10;
┌─name─────────────────────┬─is_aggregate─┬─case_insensitive─┬─alias_to─┐
│ sumburConsistentHash │ 0 │ 0 │ │
│ yandexConsistentHash │ 0 │ 0 │ │
│ demangle │ 0 │ 0 │ │
│ addressToLine │ 0 │ 0 │ │
│ JSONExtractRaw │ 0 │ 0 │ │
│ JSONExtractKeysAndValues │ 0 │ 0 │ │
│ JSONExtract │ 0 │ 0 │ │
│ JSONExtractString │ 0 │ 0 │ │
│ JSONExtractFloat │ 0 │ 0 │ │
│ JSONType │ 0 │ 0 │ │
└──────────────────────────┴──────────────┴──────────────────┴──────────┘
10 rows in set. Elapsed: 0.003 sec.
列:
name(String) 函数的名称
is_aggregate(UInt8) 该函数是否聚合
27.errors
错误代码及其触发次数。
SELECT name, code, value
FROM system.errors
WHERE value > 0
ORDER BY code ASC
LIMIT 1
┌─name─────────────┬─code─┬─value─┐
│ CANNOT_OPEN_FILE │ 76 │ 1 │
└──────────────────┴──────┴───────┘
列:
name(String) 错误的名称(errorCodeToName)
code(Int32) 错误的代码号
value(UInt64) 发生此错误的次数
last_error_time(DateTime) 上一次错误发生的时间
last_error_message(String) 上一个错误的消息
last_error_trace(Array(UInt64)) 堆栈跟踪,它表示存储被调用方法的物理地址列表
remote(UInt8) 远程异常
更多精彩内容欢迎关注微信公众号