# max_threads

max_threads is a UInt64 value from 0 through 64. The default is `0`; `1` requests serial execution.

## Automatic and explicit values

Zero selects the available hardware count capped at eight total query threads, including the query's main thread. Explicit counts are also bounded by hardware, the XML ceiling and available workers.

The setting is a ceiling, not a guarantee that every query uses several threads. Only eligible large scan aggregates use the parallel path; other query shapes can remain serial.

## Persistence

Server SET persists the selected database's value and requires autocommit with no active transactions in that database. A changed resource setting applies to later requests. An embedded connection uses `PRAGMA max_threads = value` instead.

## Example

```sql
SET max_threads = 1;
```

```sql
SELECT name, value
FROM system.settings
WHERE name = 'max_threads'
FORMAT csv;
```

```text
"max_threads","1"
```

Use peak_threads_usage in [process metadata](https://coordinatordb.com/docs/reference/system-tables/processes) to observe actual usage. Serial execution reports one total thread.
