> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-3a82795f.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Documentation for PARALLEL WITH Clause

# PARALLEL WITH Clause

Allows to execute multiple statements in parallel.

<h2 id="syntax">
  Syntax
</h2>

```sql theme={null}
statement1 PARALLEL WITH statement2 [PARALLEL WITH statement3 ...]
```

Executes statements `statement1`, `statement2`, `statement3`, ... in parallel with each other. The output of those statements is discarded.

Executing statements in parallel may be faster than just a sequence of the same statements in many cases. For example, `statement1 PARALLEL WITH statement2 PARALLEL WITH statement3` is likely to be faster than `statement1; statement2; statement3`.

<h2 id="examples">
  Examples
</h2>

Creates two tables in parallel:

```sql theme={null}
CREATE TABLE table1(x Int32) ENGINE = MergeTree ORDER BY tuple()
PARALLEL WITH
CREATE TABLE table2(y String) ENGINE = MergeTree ORDER BY tuple();
```

Drops two tables in parallel:

```sql theme={null}
DROP TABLE table1
PARALLEL WITH
DROP TABLE table2;
```

<h2 id="settings">
  Settings
</h2>

Setting [max\_threads](/reference/settings/session-settings#max_threads) controls how many threads are spawned.

<h2 id="comparison-with-union">
  Comparison with UNION
</h2>

The `PARALLEL WITH` clause is a bit similar to [UNION](/reference/statements/select/union), which also executes its operands in parallel. However there are some differences:

* `PARALLEL WITH` doesn't return any results from executing its operands, it can only rethrow an exception from them if any;
* `PARALLEL WITH` doesn't require its operands to have the same set of result columns;
* `PARALLEL WITH` can execute any statements (not just `SELECT`).
