DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk4 min

How to Speed Up ClickHouse Inserts With Bulk Ingestion

Frequent tiny synchronous inserts can create parts faster than ClickHouse can merge them. Choose producer-side batches or async inserts, keep flush acknowledgment when reliability matters, and benchmark with representative traffic.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To speed up ClickHouse inserts, avoid sending tiny synchronous writes one row at a time. Buffer rows at the producer and send larger batches when practical; when producers cannot batch conveniently, test ClickHouse asynchronous inserts. For production reliability, explicitly use wait_for_async_insert=1 so the client learns whether the buffered data was flushed successfully.

Why row-by-row inserts slow ClickHouse down

ClickHouse stores inserted data in parts. Frequent small inserts can create parts faster than background merges can consolidate them, increasing CPU and I/O work and potentially affecting query performance. The issue is not simply that each request has overhead: the resulting parts also need to be managed and merged.

As an Amazon Associate I earn from qualifying purchases.

In a ClickHouse 2023 illustration, 200 synchronous inserts every 10 seconds produced around 200 new parts per second in that workload; the authors reported reaching the active-parts safeguard after five minutes and aborting. This is an example of part pressure, not a general throughput limit. ClickHouse’s asynchronous inserts article describes the example and the underlying trade-off.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose where batching should happen

Batching can happen before data reaches ClickHouse, or in ClickHouse’s server-side asynchronous-insert buffers. The right choice depends on whether producers can tolerate the buffering delay and complexity, and whether the application needs an acknowledgment only after data has been flushed.

Approach Best fit Visibility and acknowledgment Main trade-off
Producer-side synchronous batches Producers can aggregate rows without unacceptable latency or memory cost. The client receives the synchronous insert result. Producers must implement and operate buffering; larger batches can add time before data is sent.
Server-side asynchronous inserts Many independent producers cannot conveniently batch, but their compatible inserts can be combined by ClickHouse. With wait_for_async_insert=1, acknowledgment follows flush and flush errors are returned. Flushes still consume server resources and create parts; buffering and flush timing affect visibility.

Batch at the producer when practical

If your application can hold rows briefly and send fewer, larger inserts, start there. ClickHouse’s current concurrency resource guidance recommends 10,000–100,000 rows per synchronous insert as an ideal range and at least 1,000 rows as a minimum recommendation. Treat those as vendor guidance and a test range, not guarantees: appropriate batches depend on row size, schema, latency targets, and workload. ClickHouse’s bulk-insert guidance provides the current recommendation.

Use asynchronous inserts when client batching is impractical

Asynchronous inserts move the batching work to ClickHouse. Compatible incoming insert queries are accumulated in server-side buffers and flushed when an applicable trigger is reached. A flush does not necessarily mean one part: separate buffers or nodes, multiple partitions, and oversized data can still result in multiple parts. Async inserts reduce the pressure caused by many small writes; they do not eliminate part creation, merges, or the need to test the workload.

ClickHouse’s 26.3 LTS release announcement says asynchronous inserts are enabled by default beginning with version 26.3. The same announcement describes flush triggers based on timeout, accumulated size, or number of inserts. Behavior and defaults depend on the deployed version and configuration, so check your server rather than assuming the release default applies. Read the ClickHouse 26.3 LTS announcement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep flush acknowledgment when reliability matters

For production ingestion where the application needs actionable error reporting, explicitly set wait_for_async_insert=1. The client is acknowledged after the buffer is flushed, and flush errors are returned rather than being separated from the original request. ClickHouse documents this as its default and recommended production mode in its current resource guidance, but version and configuration can change the actual default. Confirm the setting in ClickHouse’s bulk-insert documentation.

INSERT INTO events FORMAT JSONEachRow
{"event":"opened","user_id":42}
SETTINGS async_insert = 1, wait_for_async_insert = 1;

The example makes both settings explicit, avoiding reliance on defaults. Adapt the table, format, and row to your schema and client. A client may instead set these settings through its connection or query options.

Why fire-and-forget is a different reliability choice

With wait_for_async_insert=0, acknowledgment can mean the data was accepted into memory buffering, not that the flush succeeded. ClickHouse warns that this mode can hide errors and risk buffered data loss. Use it only if the application deliberately accepts those reliability and visibility trade-offs; it is not a general-purpose speed switch.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Optimize format and compression after fixing batch shape

Once inserts are batched appropriately, test the encoding and compression used to send them. ClickHouse’s FastFormats article says it considered more than 70 input formats and found the Native format led in essentially all tested scenarios. The result is vendor benchmarking, not a promise for every client library, schema, or network. Compare candidate formats on throughput, CPU, memory, payload size, and implementation cost using your own traffic. See ClickHouse’s FastFormats benchmark.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The same article identifies LZ4 as a strong compression choice and says ZSTD can matter when bandwidth is the constraint. ClickHouse reports that Netflix ingests about 5 PB of logs per day after adopting native-protocol encoding with LZ4; that is a vendor-reported case study, not an independently verified benchmark or a prediction of what another workload will achieve.

Benchmark the production mix, not just insert throughput

A faster insert benchmark can still be a poor production configuration if it increases query latency, memory use, or merge pressure. ClickHouse’s resource guidance recommends testing the production workload mix rather than sizing query classes in isolation. Compare options with representative data, concurrency, and query traffic.

  • Measure insert throughput and acknowledgment latency, including the delay until rows are visible to queries.
  • Track part counts and merge activity to see whether incoming data is creating sustainable part pressure.
  • Test producer parallelism and batch size alongside async-insert settings and flush behavior.
  • Compare input formats and compression while recording CPU, memory, and payload size.
  • Include partitioning and query effects; a batch that spans partitions can still produce multiple parts.
  • Use your actual schema, hardware, data distribution, and production traffic mix.

Asynchronous inserts gained adaptive timeout behavior in ClickHouse 24.2, and a consistent deduplication mechanism for asynchronous inserts with materialized views arrived in 26.1, according to the 26.3 release announcement. If either behavior matters to your deployment, verify the exact version and settings before relying on it.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.