> For the complete documentation index, see [llms.txt](https://docs.deltastream.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.deltastream.io/reference/sql-syntax/command/describe-query.md).

# DESCRIBE QUERY

## Syntax

```sql
DESCRIBE QUERY [query_id | query_name[:query_version]];
```

## Description

This command provides additional information about a [Streaming or Continuous Query](/overview/core-concepts/queries.md#_streaming_or_continuous_query) created in the current [Organization](/overview/core-concepts/access-control.md#organiation).

See [Query](/overview/core-concepts/queries.md) on how streaming queries operate in DeltaStream.

The query is visible only if the current role has `USAGE` privileges.

See also [DESCRIBE QUERY METRICS](/reference/sql-syntax/command/describe-query-metrics.md), [DESCRIBE QUERY EVENTS](/reference/sql-syntax/command/describe-query-events.md), [DESCRIBE QUERY STATE](/reference/sql-syntax/command/describe-query-state.md).

### Arguments <a href="#parameters" id="parameters"></a>

#### query\_id

This is the unique identifier of the query to describe. See [LIST QUERIES](/reference/sql-syntax/command/list-queries.md) to find out how to list all queries to which you have access. The first column (`ID`) in the response corresponds with the `query_id`.

#### query\_name

This is the name of the query to describe. See [LIST QUERIES](/reference/sql-syntax/command/list-queries.md) to find out how to list all queries to which you have access. The column (`Name`) in the response corresponds with the `query_name`. The `query_version` property disambiguates between multiple queries with the same name.

#### query\_version

This is the version of the query to describe. See [LIST QUERIES](/reference/sql-syntax/command/list-queries.md) to find out how to list all queries to which you have access. The column (`Version`) in the response corresponds with the `query_version`.

## Examples

#### Describe a simple query

The following describes a simple query with a [Changelog](/overview/core-concepts/databases.md#_changelog) source relation, `users_log`, filtering on a `userid` column and writing the results into a Changelog sink relation, `users2468_log`:

```sh
demodb.analytics/demostore# DESCRIBE QUERY b2041101-c37c-4807-93d4-2de876b7bd39;
+-----------+--------------------------------+
|  Property |  Value                         |
+===========+================================+
| state     | running                        |
+-----------+--------------------------------+
| source    | changelog users_log            |
+-----------+--------------------------------+
| sink      | changelog users2468_log        |
+-----------+--------------------------------+

demodb.analytics/demostore# DESCRIBE QUERY demoquery:1;
+-----------+--------------------------------+
|  Property |  Value                         |
+===========+================================+
| state     | running                        |
+-----------+--------------------------------+
| source    | changelog users_log            |
+-----------+--------------------------------+
| sink      | changelog users2468_log        |
+-----------+--------------------------------+
```

#### Describe a multi-source query

The following describes a `JOIN` query that joins a [Stream](/overview/core-concepts/databases.md#_stream), `pageviews`, and a [Changelog](/overview/core-concepts/databases.md#_changelog) relation, `users_log`, on a `userid` column and writes the resulting records into a `pv_user2468_interest` changelog relation:

```sh
demodb.analytics/demostore# DESCRIBE QUERY c81fc632-a043-472d-a1fe-aa81bc9078df;
+-----------+--------------------------------+
|  Property |  Value                         |
+===========+================================+
| state     | running                        |
+-----------+--------------------------------+
| source    | changelog users_log            |
+-----------+--------------------------------+
| source    | stream pageviews               |
+-----------+--------------------------------+
| sink      | stream pv_user2468_interest    |
+-----------+--------------------------------+

demodb.analytics/demostore# DESCRIBE QUERY demoquery:1;
+-----------+--------------------------------+
|  Property |  Value                         |
+===========+================================+
| state     | running                        |
+-----------+--------------------------------+
| source    | changelog users_log            |
+-----------+--------------------------------+
| source    | stream pageviews               |
+-----------+--------------------------------+
| sink      | stream pv_user2468_interest    |
+-----------+--------------------------------+
```

#### Describe an ERRORED query

The following describes a query stopped due to an unrecoverable failure, leaving it in the `ERRORED` state:

```sh
demodb.analytics/demostore# DESCRIBE QUERY c81fc632-a043-472d-a1fe-aa81bc9078df;
+-----------+-----------------------+
|  Property |  Value                |
+===========+=======================+
| state     | errored               |
+-----------+-----------------------+
| source    | stream pageviews      |
+-----------+-----------------------+
| sink      | stream users          |
+-----------+-----------------------+
| error     | <error stack here>    |
+-----------+-----------------------+

demodb.analytics/demostore# DESCRIBE QUERY demoquery:1;
+-----------+-----------------------+
|  Property |  Value                |
+===========+=======================+
| state     | errored               |
+-----------+-----------------------+
| source    | stream pageviews      |
+-----------+-----------------------+
| sink      | stream users          |
+-----------+-----------------------+
| error     | <error stack here>    |
+-----------+-----------------------+
```
