> ## 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.

> 包含在集群上执行的分布式 DDL 查询（使用 ON CLUSTER 子句的查询）相关信息的系统表。

# system.distributed_ddl_queue

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

包含有关集群上已执行的[分布式 DDL 查询 (ON CLUSTER 子句) ](/zh/reference/statements/distributed-ddl)的信息。

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

* `entry` ([String](/zh/reference/data-types/index)) — 查询 ID。
* `entry_version` ([Nullable(UInt8)](/zh/reference/data-types/index)) — 条目的版本。
* `initiator_host` ([Nullable(String)](/zh/reference/data-types/index)) — 发起 DDL 操作的主机。
* `initiator_port` ([Nullable(UInt16)](/zh/reference/data-types/index)) — 发起方使用的端口。
* `cluster` ([String](/zh/reference/data-types/index)) — 集群名称；如果无法确定，则为空。
* `query` ([String](/zh/reference/data-types/index)) — 执行的查询。
* `settings` ([Map(String, String)](/zh/reference/data-types/index)) — DDL 操作中使用的设置。
* `query_create_time` ([DateTime](/zh/reference/data-types/index)) — 查询创建时间。
* `host` ([Nullable(String)](/zh/reference/data-types/index)) — 主机名。
* `port` ([Nullable(UInt16)](/zh/reference/data-types/index)) — 主机端口。
* `status` ([Nullable(Enum8('Inactive' = 0, 'Active' = 1, 'Finished' = 2, 'Removing' = 3, 'Unknown' = 4))](/zh/reference/data-types/index)) — 查询状态。
* `exception_code` ([Nullable(UInt16)](/zh/reference/data-types/index)) — 异常代码。
* `exception_text` ([Nullable(String)](/zh/reference/data-types/index)) — 异常消息。
* `query_finish_time` ([Nullable(DateTime)](/zh/reference/data-types/index)) — 查询完成时间。
* `query_duration_ms` ([Nullable(UInt64)](/zh/reference/data-types/index)) — 查询执行耗时 (毫秒) 。

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

```sql theme={null}
SELECT *
FROM system.distributed_ddl_queue
WHERE cluster = 'test_cluster'
LIMIT 2
FORMAT Vertical

Query id: f544e72a-6641-43f1-836b-24baa1c9632a

Row 1:
──────
entry:             query-0000000000
entry_version:     5
initiator_host:    clickhouse01
initiator_port:    9000
cluster:           test_cluster
query:             CREATE DATABASE test_db UUID '4a82697e-c85e-4e5b-a01e-a36f2a758456' ON CLUSTER test_cluster
settings:          {'max_threads':'16','use_uncompressed_cache':'0'}
query_create_time: 2023-09-01 16:15:14
host:              clickhouse-01
port:              9000
status:            Finished
exception_code:    0
exception_text:    
query_finish_time: 2023-09-01 16:15:14
query_duration_ms: 154

Row 2:
──────
entry:             query-0000000001
entry_version:     5
initiator_host:    clickhouse01
initiator_port:    9000
cluster:           test_cluster
query:             CREATE DATABASE test_db UUID '4a82697e-c85e-4e5b-a01e-a36f2a758456' ON CLUSTER test_cluster
settings:          {'max_threads':'16','use_uncompressed_cache':'0'}
query_create_time: 2023-09-01 16:15:14
host:              clickhouse-01
port:              9000
status:            Finished
exception_code:    630
exception_text:    Code: 630. DB::Exception: Cannot drop or rename test_db, because some tables depend on it:
query_finish_time: 2023-09-01 16:15:14
query_duration_ms: 154

2 rows in set. Elapsed: 0.025 sec.
```
