有没有 table 我可以在 clickhouse 中找到所有 table 索引的地方?

Is there any table where I can find all table indexes in clickhouse?

我在网上找了很久。但是没有用。请帮助或尝试提供一些想法如何实现 this.Now,我可以通过解析 create_table_query 字段获得所有 table 索引,是否有任何 table 直接存储索引信息,喜欢 MySQL information_schema.STATISTICS


 select t.*,splitByString(' TYPE ',trim(index_column)) as index_info,
 mid(index_info[1],POSITION (index_info[1],' ') + 1 ,100) index_columns,
 index_info[2] as index_type
 from (
 select database ,name as table_name,engine,create_table_query ,total_rows, partition_key ,sorting_key ,primary_key ,sampling_key ,
 extractAll(create_table_query,'INDEX(.*?)GRANULARITY') index_arr
 from `system`.tables t where database  in ('ods','uds','efc','dss','old')
 and engine not in ('View')
 ) t 
 left ARRAY JOIN index_arr as index_column

只有 table 引擎 *MergeTree 家族有索引, 每个 *MergeTree table 都有主索引(不是唯一的)你可以通过 SELECT * FROM system.columns WHERE is_in_primary_key=1

知道主索引中包含哪些字段

此外,二级数据跳过索引可用, https://clickhouse.tech/docs/en/engines/table-engines/mergetree-family/mergetree/#table_engine-mergetree-data_skipping-indexes

但不幸的是,没有系统。* table 可用于显示 table

中存在的辅助数据跳过索引

如果您想知道在查询过程中使用了哪些辅助数据以及如何跳过索引,您可以使用 follow SQL queries

SET send_logs_level='trace';
SELECT ... your query;

并期待

Index `index_name` has dropped X/Y granules