官方文档:https://clickhouse.tech/docs/en/operations/system-tables/
1.system tables 目录
system.asynchronous_metric_log -- 保留system.asynchronous_metrics的历史值
system.asynchronous_metrics -- 包含在后台定期计算的指标
system.clusters -- 包含有关配置文件中可用群集以及其中服务器的信息
system.contributors -- 包含有关贡献者的信息
system.crash_log -- 包含有关堆栈跟踪的致命错误信息
system.data_type_families -- 包含有关支持的数据类型的信息
system.detached_parts -- 包含有关MergeTree表的分离部分的信息
system.dictionaries -- 包含有关外部词典的信息
system.distributed_ddl_queue -- 包含有关在集群上执行的分布式ddl查询(ON CLUSTER子句)的信息
system.distribution_queue -- 包含有关队列中要发送到分片的本地文件的信息
system.processes -- 该系统表用于实现SHOW PROCESSLIST查询
system.tables -- 包含服务器知道的每个表的元数据
system.columns -- 包含有关所有表中列的信息
system.grants -- 授予ClickHouse用户帐户的特权
system.databases -- 包含有关当前用户可用的数据库的信息
system.disks -- 包含有关服务器配置中定义的磁盘的信息
system.errors -- 包含错误代码及其触发次数
system.events -- 包含有关系统中发生的事件数的信息
system.settings -- 包含有关当前用户的会话设置的信息
system.users -- 包含在服务器上配置的用户帐户列表
system.roles -- 包含有关已配置角色的信息
system.merges -- 包含有关MergeTree系列表中当前正在处理的合并和零件突变的信息
system.current_roles -- 包含当前用户的活动角色
system.enabled_roles -- 包含当前所有活动角色
system.functions -- 包含有关正常函数和聚合函数的信息
system.role_grants -- 包含用户和角色的角色授予
system.graphite_retentions -- 包含有关graphite_rollup参数的信息
system.licenses -- 包含位于ClickHouse来源的contrib目录中的第三方库的许可证
system.merge_tree_settings -- 包含有关MergeTree表设置的信息
system.metric_log -- 包含来自表system.metrics和的指标值的历史记录
system.metrics -- 包含可以立即计算或具有当前值的指标
system.mutations -- 该表包含有关MergeTree表的突变及其进度的信息
system.numbers -- 包含几乎所有从零开始的自然数
system.numbers_mt -- 与system.numbers相同,但读取是并行的
system.one -- 如果SELECT查询未指定FROM子句则使用此表,类似于oracle的dual
system.part_log -- 仅当指定part_log服务器设置时才创建该表
system.parts -- 包含有关MergeTree表分区的信息
system.parts_columns -- 包含有关MergeTree表分区列的信息
system.query_log -- 包含有关已执行查询的信息
system.query_thread_log -- 包含有关执行查询的线程的信息
system.quota_limits -- 包含有关所有配额的所有间隔的最大值的信息
system.quota_usage -- 当前用户的配额使用情况
system.quotas -- 包含有关配额的信息
system.quotas_usage -- 有用户的配额使用情况
system.replicas -- 包含驻留在本地服务器上的复制表的信息和状态
system.replicated_fetches -- 包含有关当前运行的后台提取的信息
system.replication_queue -- 包含有关存储在ZooKeeper中用于该ReplicatedMergeTree族表的复制队列中任务的信息
system.row_policies -- 包含用于一个特定表的过滤器,以及应使用此行策略的角色和/或用户的列表
system.settings_profile_elements -- 描述设置配置文件的内容
system.settings_profiles -- 包含已配置设置配置文件的属性
system.stack_trace -- 包含所有服务器线程的堆栈跟踪
system.storage_policies -- 包含有关服务器配置中定义的存储策略和卷的信息
system.table_engines -- 包含服务器支持的表引擎的描述及其功能支持信息
system.text_log -- 包含日志记录条目
system.time_zones -- 包含ClickHouse服务器支持的时区列表
system.trace_log -- 包含由抽样查询分析器收集的堆栈跟踪
system.zookeeper -- 允许从配置中定义的ZooKeeper集群读取数据
2.常用系统表
(1)system.processes
- user(String)–进行查询的用户。
- address(String)–发出请求的IP地址。
- elapsed(Float64)–自请求执行开始以来的时间(以秒为单位)。
- rows_read(UInt64)–从表中读取的行数。
- bytes_read(UInt64)–从表中读取的未压缩字节数。
- total_rows_approx(UInt64)–应该读取的行总数的近似值。
- memory_usage(UInt64)–请求使用的RAM量。
- query(字符串)–查询文本。对于INSERT,它不包括要插入的数据。
- query(字符串)–查询id(如果已定义)。
(2)system.tables
- database (String) - The name of the database the table is in.
- name (String) - Table name.
- engine (String) - Table engine name (without parameters).
- is_temporary (UInt8) - 指示表是否是临时的标志。
- data_path (String) - 文件系统中表数据的路径。
- metadata_path (String) - 文件系统中表元数据的路径。
- metadata_modification_time (DateTime) - 表元数据的最新修改时间。
- dependencies_database (数组(字符串)) - 数据库依赖关系.
- dependencies_table (数组(字符串)) - 表依赖关系 (MaterializedView 基于当前表的表)。
- create_table_query (String) - 用于创建表的查询。
- engine_full (String) - 表引擎的参数。
- partition_key (String) - 表中指定的分区键表达式。
- sorting_key (String) - 表中指定的排序键表达式。
- primary_key (String) - 表中指定的主键表达式。
- sampling_key (String) - 表中指定的采样键表达式。
- storage_policy (字符串) - 存储策略:MergeTree/分布
- total_rows (Nullable(UInt64)) - 总行数,如果可以快速确定表中的确切行数,否则 Null (包括内衣 Buffer 表)。
- total_bytes (Nullable(UInt64)) - 总字节数,如果可以快速确定存储表的确切字节数,否则 Null (不 包括任何底层存储)。
(3)system.columns
database
(String) — Database name.table
(String) — Table name.name
(String) — Column name.type
(String) — Column type.default_kind
(String) — Expression type (DEFAULT
,MATERIALIZED
,ALIAS
)为默认值,如果没有定义,则为空字符串。default_expression
(String) — Expression for the default value, or an empty string if it is not defined.data_compressed_bytes
(UInt64) — The size of compressed data, in bytes.data_uncompressed_bytes
(UInt64) — The size of decompressed data, in bytes.marks_bytes
(UInt64) — The size of marks, in bytes.comment
(String) — Comment on the column, or an empty string if it is not defined.is_in_partition_key
(UInt8) — Flag that indicates whether the column is in the partition expression.is_in_sorting_key
(UInt8) — Flag that indicates whether the column is in the sorting key expression.is_in_primary_key
(UInt8) — Flag that indicates whether the column is in the primary key expression.is_in_sampling_key
(UInt8) — Flag that indicates whether the column is in the sampling key expression.