> 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-events.md).

# DESCRIBE QUERY EVENTS

## Syntax

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

## Description

This command provides a list of events for 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.

### 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 the user has 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 the user has 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 the user has access. The column (`Version`) in the response corresponds with the `query_version`. If `query_name` is provided without a `query_version`, the system uses `query_version`.

## Examples

#### Show query events when running and stopped

```bash
demodb.public/demostore# DESCRIBE QUERY EVENTS 5b9ba120-bb59-4c95-82c5-6ee0f78dc75e;
+-------------------------------+----------------------+---------+-----------+
|           Created At          |        Actor         |   Type  |  Messages |
+-------------------------------+----------------------+---------+-----------+
| 2024-08-09 15:45:32 +0000 UTC | system               | running |           |
+-------------------------------+----------------------+---------+-----------+
| 2024-08-09 15:45:01 +0000 UTC | delta@deltastream.io | created |           |
+-------------------------------+----------------------+---------+-----------+

demodb.public/demostore# DESCRIBE QUERY EVENTS demoquery:1;
+-------------------------------+----------------------+---------+-----------+
|           Created At          |        Actor         |   Type  |  Messages |
+-------------------------------+----------------------+---------+-----------+
| 2024-08-09 15:45:32 +0000 UTC | system               | running |           |
+-------------------------------+----------------------+---------+-----------+
| 2024-08-09 15:45:01 +0000 UTC | delta@deltastream.io | created |           |
+-------------------------------+----------------------+---------+-----------+

demodb.public/demostore# DESCRIBE QUERY EVENTS 24f5a97b-97e9-40eb-8dbf-431b96474972;
+-------------------------------+----------------------+---------------------+-----------+
|           Created At          |        Actor         |         Type        |  Messages |
+-------------------------------+----------------------+---------------------+-----------+
| 2024-08-09 15:47:57 +0000 UTC | system               | terminated          |           |
+-------------------------------+----------------------+---------------------+-----------+
| 2024-08-09 15:47:40 +0000 UTC | delta@deltastream.io | terminate_requested |           |
+-------------------------------+----------------------+---------------------+-----------+
| 2024-08-09 15:45:32 +0000 UTC | system               | running             |           |
+-------------------------------+----------------------+---------------------+-----------+
| 2024-08-09 15:45:01 +0000 UTC | delta@deltastream.io | created             |           |
+-------------------------------+----------------------+---------------------+-----------+

demodb.public/demostore# DESCRIBE QUERY EVENTS demoquery:1;
+-------------------------------+----------------------+---------------------+-----------+
|           Created At          |        Actor         |         Type        |  Messages |
+-------------------------------+----------------------+---------------------+-----------+
| 2024-08-09 15:47:57 +0000 UTC | system               | terminated          |           |
+-------------------------------+----------------------+---------------------+-----------+
| 2024-08-09 15:47:40 +0000 UTC | delta@deltastream.io | terminate_requested |           |
+-------------------------------+----------------------+---------------------+-----------+
| 2024-08-09 15:45:32 +0000 UTC | system               | running             |           |
+-------------------------------+----------------------+---------------------+-----------+
| 2024-08-09 15:45:01 +0000 UTC | delta@deltastream.io | created             |           |
+-------------------------------+----------------------+---------------------+-----------+
```

#### Show events for a query that has been rescheduled

You can reschedule queries for any number of reasons. Typically you reschedule a query if a you must move it to another node.

```bash
demodb.public/demostore# DESCRIBE QUERY EVENTS demoquery:1;
+-------------------------------+----------------------+---------------------+-----------+
|           Created At          |        Actor         |         Type        |  Messages |
+-------------------------------+----------------------+---------------------+-----------+
| 2024-08-09 15:47:57 +0000 UTC | system               | running             |           |
+-------------------------------+----------------------+---------------------+-----------+
| 2024-08-09 15:47:40 +0000 UTC | system               | rescheduled         |           |
+-------------------------------+----------------------+---------------------+-----------+
| 2024-08-09 15:45:32 +0000 UTC | system               | running             |           |
+-------------------------------+----------------------+---------------------+-----------+
| 2024-08-09 15:45:01 +0000 UTC | delta@deltastream.io | created             |           |
+-------------------------------+----------------------+---------------------+-----------+
```

The following example shows an errored query:

```bash
testdb.public/internal_stage# DESCRIBE QUERY EVENTS 142ecf31-bc8d-496b-bd0b-28ebb4a8757e;
+-------------------------------+----------------------+---------------------+------------------+
|           Created At          |        Actor         |         Type        |      Messages    |
+-------------------------------+----------------------+---------------------+------------------+
| 2024-08-09 15:46:32 +0000 UTC | system               | errored             |  <error_message> |
+-------------------------------+----------------------+---------------------+------------------+
| 2024-08-09 15:45:32 +0000 UTC | system               | running             |                  |
+-------------------------------+----------------------+---------------------+------------------+
| 2024-08-09 15:45:01 +0000 UTC | delta@deltastream.io | created             |                  |
+-------------------------------+----------------------+---------------------+------------------+
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.deltastream.io/reference/sql-syntax/command/describe-query-events.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
