---
title: "Supercharging your large ClickHouse data loads - Part 2: Tuning a large data load for speed"
description: "Tuning insert block size and insert parallelism lets a 65-billion-row (~14 TiB raw) PyPI load into ClickHouse run almost 3x faster than with default settings on the same hardware."
url: "https://swe.quest/articles/supercharging-your-large-clickhouse-data-loads-part-2-tuning-a-large-data-load-646edfb3ee681d30"
canonical: "https://clickhouse.com/blog/supercharge-your-clickhouse-data-loads-part2"
source: "ClickHouse"
published: "2023-10-18"
difficulty: "medium"
kind: "How-to"
reading_minutes: 10
tags: ["analytics","performance","data-pipelines","scalability"]
---

# Supercharging your large ClickHouse data loads - Part 2: Tuning a large data load for speed

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2023-10-18, 10 min read, How-to. Original: [https://clickhouse.com/blog/supercharge-your-clickhouse-data-loads-part2](https://clickhouse.com/blog/supercharge-your-clickhouse-data-loads-part2)

## Summary

Tuning insert block size and insert parallelism lets a 65-billion-row (~14 TiB raw) PyPI load into ClickHouse run almost 3x faster than with default settings on the same hardware. On servers with 59 cores and 236 GiB RAM, the sweet spot was 32 insert threads with 10-million-row blocks. Larger blocks exhaust memory at higher thread counts, while using all cores for inserts starves background merges. A rule of thumb follows: set max\_insert\_threads to about half the cores, and set min\_insert\_block\_size\_bytes to target peak memory / (~3 × threads). With SharedMergeTree in ClickHouse Cloud, ingest throughput scales linearly as servers are added.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Data pipelines](https://swe.quest/tags/data-pipelines.md) (Data & databases)
- [Scaling](https://swe.quest/tags/scalability.md) (Distributed systems)

## Prerequisites

- ClickHouse MergeTree parts and merges ([easy posts on Analytics & OLAP](https://swe.quest/tags/analytics.md?difficulty=easy))
- INSERT INTO SELECT

## Keywords

ClickHouse, ClickHouse Cloud, SharedMergeTree, s3Cluster, max\_insert\_threads, min\_insert\_block\_size\_bytes, PyPI dataset

## Related posts

- [Supercharging your large ClickHouse data loads - Part 1: Performance and resource usage factors](https://swe.quest/articles/supercharging-your-large-clickhouse-data-loads-part-1-performance-and-resource-9144b512c7e0ece3.md): ClickHouse · 2023-09-19 · Medium · 10 min read · Analytics & OLAP, Performance engineering, Storage engines, Data pipelines
  ClickHouse ingest performance and resource usage for large loads into MergeTree tables are governed by three factors: insert block size, insert parallelism, and hardware size.
- [ClickHouse Newsletter October 2022: A cloud has arrived](https://swe.quest/articles/clickhouse-newsletter-october-2022-a-cloud-has-arrived-ea3242fdda480e88.md): ClickHouse · 2022-10-13 · Medium · 6 min read · Analytics & OLAP, Performance engineering, Cloud platforms, Vector search
  ClickHouse Cloud entered public beta, storing data on shared object storage reachable by all nodes, so users no longer configure replication, sharding or rebalancing, and storage costs less than on block storage.
- [How we configure huge pages in ClickHouse Managed Postgres](https://swe.quest/articles/how-we-configure-huge-pages-in-clickhouse-managed-postgres-6544ec044914bebf.md): ClickHouse · 2026-07-14 · Medium · 5 min read · PostgreSQL, Linux, Performance engineering, Memory management, Configuration management
  ClickHouse Managed Postgres runs every server's shared\_buffers on 2MB huge pages, which avoids per-backend page-table bloat and improves TLB reach.
- [Supercharging your large ClickHouse data loads - Part 3: Making a large data load resilient](https://swe.quest/articles/supercharging-your-large-clickhouse-data-loads-part-3-making-a-large-data-load-9cbef13f424019e6.md): ClickHouse · 2023-11-01 · Medium · 13 min read · Analytics & OLAP, Data pipelines, Resilience, Databases
  Multi-day loads of billions to trillions of rows into ClickHouse can survive transient failures by splitting the input into retryable tasks.
- [Asynchronous Data Inserts in ClickHouse](https://swe.quest/articles/asynchronous-data-inserts-in-clickhouse-7e5b81fdcf244f48.md): ClickHouse · 2023-08-01 · Medium · 19 min read · Analytics & OLAP, Storage engines, Performance engineering, Observability
  ClickHouse asynchronous inserts move batching from the client to the server.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
