> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8c05c8a2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> 显示查询缓存内容的系统表。

# system.query_cache

<Info>
  **在 ClickHouse Cloud 中查询**

  此系统表中的数据分别保存在 ClickHouse Cloud 各节点的本地。因此，如需查看所有数据的完整情况，需要使用 `clusterAllReplicas` 函数。更多详情请参见[此处](/zh/reference/system-tables/overview#system-tables-in-clickhouse-cloud)。
</Info>

<div id="description">
  ## 描述
</div>

显示[查询缓存](/zh/concepts/features/performance/caches/query-cache)中的内容。

<div id="columns">
  ## 列
</div>

* `query` ([String](/zh/reference/data-types/index)) — 查询文本。
* `query_id` ([String](/zh/reference/data-types/index)) — 查询的 ID。
* `is_subquery` ([UInt8](/zh/reference/data-types/index)) — 查询缓存条目是否为子查询结果。
* `result_size` ([UInt64](/zh/reference/data-types/index)) — 查询缓存条目的大小。
* `tag` ([LowCardinality(String)](/zh/reference/data-types/index)) — 查询缓存条目的标签。
* `stale` ([UInt8](/zh/reference/data-types/index)) — 查询缓存条目是否已失效。
* `shared` ([UInt8](/zh/reference/data-types/index)) — 查询缓存条目是否由多个用户共享。
* `compressed` ([UInt8](/zh/reference/data-types/index)) — 查询缓存条目是否已压缩。
* `expires_at` ([DateTime](/zh/reference/data-types/index)) — 查询缓存条目何时失效。
* `key_hash` ([UInt64](/zh/reference/data-types/index)) — 查询文本的哈希值，用作查找查询缓存条目的键。

<div id="example">
  ## 示例
</div>

```sql theme={null}
SELECT * FROM system.query_cache FORMAT Vertical;
```

```text theme={null}
Row 1:
──────
query:       SELECT 1 SETTINGS use_query_cache = 1
query_id:    7c28bbbb-753b-4eba-98b1-efcbe2b9bdf6
result_size: 128
tag:
stale:       0
shared:      0
compressed:  1
expires_at:  2023-10-13 13:35:45
key_hash:    12188185624808016954

1 row in set. Elapsed: 0.004 sec.
```
