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

# How do I solve TOO MANY PARTS error during an INSERT...SELECT?

> Resolve the TOO_MANY_PARTS error in ClickHouse during an `INSERT...SELECT` by tuning expert-level settings for larger blocks and increasing partition thresholds.

## Question

When executing a `INSERT...SELECT` statement, I am getting too many parts (TOO\_MANY\_PARTS) error.

How can I solve this?

## Answer

Below are some of the settings to tune to avoid this error, this is expert level tuning of ClickHouse and these values should be set only after understanding the specifications of the ClickHouse cloud service or on-prem cluster where these will be used, so do not take these values as "one size fits all".

[max\_insert\_block\_size](/reference/settings/session-settings#settings-max_insert_block_size) = `100_000_000` (default `1_048_576`)

Increase from \~1M to 100M would allow larger blocks to form

Note: This setting only applies when the server forms the blocks. i.e. INSERT via the HTTP interface, and not for clickhouse-client

[min\_insert\_block\_size\_rows](/reference/settings/session-settings#min-insert-block-size-rows) = `100_000_000` (default `1_048_576`)

Increase from \~1M to 100M would allow larger blocks to form.

[min\_insert\_block\_size\_bytes](/reference/settings/session-settings#min-insert-block-size-bytes) = `500_000_000` (default `268_435_456`)

Increase from 268.44 MB to 500 MB would allow larger blocks to form.

[parts\_to\_delay\_insert](/reference/settings/merge-tree-settings#parts-to-delay-insert) = `500` (default `150`)

Increasing this so that INSERTs are not artificially slowed down when the number of active parts in a single partition is reached.

[parts\_to\_throw\_insert](/reference/settings/merge-tree-settings#parts-to-throw-insert) = `1500` (default `3000`)

Increasing this would generally affect query performance to the table, but this would be fine for data migration.
