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

# system.distributed_ddl_queue

> System table containing information about distributed ddl queries (queries using the ON CLUSTER clause) that were executed on a cluster.

## Description

Contains information about [distributed ddl queries (ON CLUSTER clause)](https://clickhouse.com/docs/reference/statements/distributed-ddl.md) that were executed on a cluster.

## Columns

* `entry` ([String](https://clickhouse.com/docs/reference/data-types/string.md)) — Query id.
* `entry_version` ([Nullable(UInt8)](https://clickhouse.com/docs/reference/data-types/nullable.md)) — Version of the entry.
* `initiator_host` ([Nullable(String)](https://clickhouse.com/docs/reference/data-types/nullable.md)) — Host that initiated the DDL operation.
* `initiator_port` ([Nullable(UInt16)](https://clickhouse.com/docs/reference/data-types/nullable.md)) — Port used by the initiator.
* `cluster` ([String](https://clickhouse.com/docs/reference/data-types/string.md)) — Cluster name, empty if not determined.
* `query` ([String](https://clickhouse.com/docs/reference/data-types/string.md)) — Query executed.
* `settings` ([Map(String, String)](https://clickhouse.com/docs/reference/data-types/map.md)) — Settings used in the DDL operation.
* `query_create_time` ([DateTime](https://clickhouse.com/docs/reference/data-types/datetime.md)) — Query created time.
* `host` ([Nullable(String)](https://clickhouse.com/docs/reference/data-types/nullable.md)) — Hostname.
* `port` ([Nullable(UInt16)](https://clickhouse.com/docs/reference/data-types/nullable.md)) — Host Port.
* `status` ([Nullable(Enum8('Inactive' = 0, 'Active' = 1, 'Finished' = 2, 'Removing' = 3, 'Unknown' = 4))](https://clickhouse.com/docs/reference/data-types/nullable.md)) — Status of the query.
* `exception_code` ([Nullable(UInt16)](https://clickhouse.com/docs/reference/data-types/nullable.md)) — Exception code.
* `exception_text` ([Nullable(String)](https://clickhouse.com/docs/reference/data-types/nullable.md)) — Exception message.
* `query_finish_time` ([Nullable(DateTime)](https://clickhouse.com/docs/reference/data-types/nullable.md)) — Query finish time.
* `query_duration_ms` ([Nullable(UInt64)](https://clickhouse.com/docs/reference/data-types/nullable.md)) — Duration of query execution (in milliseconds).

## Example

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