Skip to content
ClickHouse Docs
ClickHouse DocsClickHouse Docs

system.hypothetical_indexes

列出当前会话中定义的所有假设性 (what-if) 跳过索引。参见 CREATE HYPOTHETICAL INDEXEXPLAIN WHATIF

其内容受会话范围限制:每个连接只能看到自己的假设性索引;如果当前会话中尚未创建任何索引,则该表为空。

当前的 (database, table) 会在查询时按 UUID 解析,因此会反映 RENAME TABLE 的结果,并且已删除表对应的条目会自动隐藏。

  • database (String) — 数据库名称
  • table (String) — 表名称
  • name (String) — 索引名称
  • type (String) — 索引类型 (minmax、set、bloom_filter 等)
  • type_full (String) — 包含参数的索引类型表达式,例如 bloom_filter(0.01)
  • expression (String) — 索引表达式
  • granularity (UInt64) — 索引粒度

示例

CREATE HYPOTHETICAL INDEX i1 ON t (b) TYPE bloom_filter(0.01)  GRANULARITY 1;
CREATE HYPOTHETICAL INDEX i2 ON t (b) TYPE bloom_filter(0.001) GRANULARITY 1;

SELECT database, table, name, type, type_full, expression, granularity
FROM system.hypothetical_indexes;
┌─database─┬─table─┬─name─┬─type─────────┬─type_full───────────┬─expression─┬─granularity─┐
│ default  │ t     │ i1   │ bloom_filter │ bloom_filter(0.01)  │ b          │           1 │
│ default  │ t     │ i2   │ bloom_filter │ bloom_filter(0.001) │ b          │           1 │
└──────────┴───────┴──────┴──────────────┴─────────────────────┴────────────┴─────────────┘

type 是基本类型名称,type_full 则包含参数,因此用户可以区分 bloom_filter(0.01)bloom_filter(0.001) 这类带参数的变体。

另请参见

Navigation