# RESTART QUERY

## Syntax <a href="#synopsis" id="synopsis"></a>

```sql
RESTART QUERY query_id;
```

## Description <a href="#description" id="description"></a>

This command restarts a the failed query specified by the `query_id`. Before restarting a query, the user should use `DESCRIBE QUERY` to check the logs and determine if it is worthwhile restarting the query, or address issues before restarting the query. Terminated queries cannot be restarted.

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

#### query\_id

This specifies the unique identifier of the query to restart. See [LIST QUERIES](/reference/sql-syntax/command/list-queries.md) to find out how to list all queries that the user has access to. The first column (`ID`) in the response corresponds with the `query_id`.

## Examples

#### Restart a Query

The following is an example of how to restart a query. The [LIST QUERIES](/reference/sql-syntax/command/list-queries.md) command is used to find the `query_id`.

```sh
demo_db.public/demostore# LIST QUERIES;
+--------------------------------------+-----------------+---------------+-------------------------------+----------+-------------------------------+-------------------------------+
|  ID                                  |  Intended State |  Actual State |  Query                        |  Owner   |  Created At                   |  Updated At                   |
+======================================+=================+===============+===============================+==========+===============================+===============================+
| 3d716a1a-1c38-4a18-9365-9def343731b8 | running         | errored       | CREATE STREAM pageviews2 AS   | sysadmin | 2023-02-08 22:08:25 +0000 UTC | 2023-02-09 00:11:14 +0000 UTC |
|                                      |                 |               | SELECT * FROM pageviews;      |          |                               |                               |
+--------------------------------------+-----------------+---------------+-------------------------------+----------+-------------------------------+-------------------------------+
demo_db.public/demostore# RESTART QUERY 3d716a1a-1c38-4a18-9365-9def343731b8;
+-------+--------------------------------------+----------+------------------------------------------+
|  Type |  Name                                |  Command |  Summary                                 |
+=======+======================================+==========+==========================================+
| query | 3d716a1a-1c38-4a18-9365-9def343731b8 | UPDATE   | query                                    |
|       |                                      |          | 3d716a1a-1c38-4a18-9365-9def343731b8     |
|       |                                      |          | was marked for restart                   |
+-------+--------------------------------------+----------+------------------------------------------+
```


---

# Agent Instructions: 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:

```
GET https://docs.deltastream.io/reference/sql-syntax/query/restart-query.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
