> 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/query/restart-query.md).

# 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                   |
+-------+--------------------------------------+----------+------------------------------------------+
```
