> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> 列出当前 session 中定义的假设性（what-if）projections 的系统表

# system.hypothetical_projections

## 描述

列出当前 session 中定义的所有假设性 (what-if) projection。参见 [`CREATE HYPOTHETICAL PROJECTION`](/docs/zh/reference/statements/hypothetical-projection#create-hypothetical-projection) 和 [`EXPLAIN WHATIF`](/docs/zh/reference/statements/explain#explain-whatif)。

其内容的作用域限定在 session 级别：每个 connection 只能看到自身的假设性 projections；若当前 session 中尚未创建任何此类 projection，该表为空。

当前的 `(database, table)` 会在 query time 通过 UUID 解析，因此能够反映 `RENAME TABLE` 的结果，并自动隐藏已 drop 表所对应的 entries。

## 列

* `database` ([String](/docs/zh/reference/data-types/string)) — 数据库名称
* `table` ([String](/docs/zh/reference/data-types/string)) — 表名
* `name` ([String](/docs/zh/reference/data-types/string)) — PROJECTION 名称
* `type` ([Enum8('Normal' = 0, 'Aggregate' = 1)](/docs/zh/reference/data-types/enum)) — PROJECTION 类型
* `sorting_key` ([Array(String)](/docs/zh/reference/data-types/array)) — PROJECTION 的排序键
* `query` ([String](/docs/zh/reference/data-types/string)) — PROJECTION 的 SELECT 查询；对于 INDEX ... TYPE ... 形式则为空
* `definition` ([String](/docs/zh/reference/data-types/string)) — 按原始书写形式给出的完整 PROJECTION 声明
* `settings` ([Map(String, String)](/docs/zh/reference/data-types/map)) — 来自 WITH SETTINGS 的 PROJECTION 设置

## 示例

```sql theme={null}
CREATE HYPOTHETICAL PROJECTION p_by_b ON t (SELECT a, b ORDER BY b);
SELECT name, type, sorting_key FROM system.hypothetical_projections;
```

```text theme={null}
┌─name───┬─type───┬─sorting_key─┐
│ p_by_b │ Normal │ ['b']       │
└────────┴────────┴─────────────┘
```

## 另请参阅

* [`CREATE HYPOTHETICAL PROJECTION`](/docs/zh/reference/statements/hypothetical-projection#create-hypothetical-projection)
* [`EXPLAIN WHATIF`](/docs/zh/reference/statements/explain#explain-whatif)
