Blog

Questions readers ask: Is ClickHouse faster than DuckDB for analytical queries?

Analytical query performance depends on where those queries run and who shares the system. DuckDB’s in-process model gives it an advantage in local, embedded work. ClickBench makes that split visible query by query.

Why "which is faster" is the wrong question without a deployment context

DuckDB embeds directly into the calling process. DuckDB can answer a local analytical query without a network round-trip or a separate server. That distinction is its central design advantage. For an application or analyst working with data on one machine, this saves work that a client-server deployment would add. A shared analytical service, though, has to serve requests from outside the calling application.

The dominant performance variable is therefore the architecture. A fast query inside a notebook and a fast query serving a shared dashboard answer different operational questions. Both timings can be valid without being interchangeable. A benchmark establishes how an engine performs under its measured conditions, which may or may not resemble the work the engine must actually serve in its deployment.

What ClickBench actually measures and why it is the right evidence to use

ClickBench provides a shared analytical workload rather than a comparison assembled from unrelated demonstrations. Its web analytics and clickstream dataset combines wide tables, high-cardinality columns, and heavy aggregations. Those characteristics resemble operational analytics and observability workloads. They make the benchmark useful for practitioners evaluating queries that do more than retrieve a small set of records. The public results, scripts, and dataset also make the comparison reproducible.

Both engines finish all 43 queries in the suite, so neither looks faster because it left hard queries unfinished. This makes the comparison clean on query completion. ClickBench excludes failed queries from its median but records them in a separate failure column. That distinction is important when interpreting benchmark rankings generally, because a median of successful queries alone does not establish coverage. Here, completion lets the analysis turn directly to latency and the shape of the results.

Latency budgets give those results a practical purpose. An engine that meets a tighter budget can also serve a looser one, but the reverse does not hold. A median therefore provides useful evidence about which response-time requirements an engine can meet under the benchmark’s conditions. Query-level results then show where that central measure conceals differences between workloads.

How the 43-query result splits: where each engine leads and what the pattern reveals

DuckDB’s wins cluster around queries where data fits in RAM and no network hop intervenes. Those conditions favor execution inside the calling process. Its advantage is not scattered arbitrarily across the workload, but follows the setting its architecture is designed to exploit.

The benchmark tests a single-node, hot-cache, single-query scenario. Production adds two separate pressures beyond that setting. The first is data volume beyond a single machine, and the second is concurrent query load. A timing measured with one query running does not itself establish how a service will behave when many consumers submit work. Likewise, a result for data held on one node does not establish a path to distributed execution.

DuckDB does not distribute its work across machines. When a dataset outgrows what a single node can hold in memory or on local storage, the deployment reaches an architectural boundary. That boundary is different from exceeding RAM alone. Data that fits on local storage can still belong to a single-machine workflow, even when it no longer enjoys the in-memory conditions behind DuckDB’s strongest results. The relevant scale threshold is the capacity of the machine.

DuckDB’s single-process model permits only one writer at a time, but it can serve multiple concurrent read queries across available CPU cores. It is not restricted to one reader. Nevertheless, hundreds of concurrent dashboard queries are not the workload that architecture is designed to serve.

PostHog's migration history as a live experiment in where each engine fits

PostHog’s migration history gives the architecture argument a concrete production setting. Its first act was adopting DuckDB through a DuckLake catalog as part of an intermediate warehouse architecture. PostHog described that stage plainly, saying “We've rebuilt on top of DuckDB: DuckLake as our catalog.” DuckDB served a useful role at that scale. The adoption is evidence of fit.

The second act began when the catalog reached roughly two petabytes, an enormous row count, and millions of snapshots. At that point, the architecture no longer served PostHog’s needs. PostHog subsequently stated, “We moved our warehouse product off DuckDB and DuckLake onto our own flavor of Trino and a new open table format, HogLake.” The destination was a distributed system, rather than another attempt to keep the same workload within the earlier deployment model. The requirements had crossed an architectural boundary.

That history tests the broader question of where each kind of architecture fits. The catalog’s size also does not tell other teams when they must migrate, because the account describes PostHog’s workload and the conditions it ran under. Its value is more specific. A design that served the warehouse at one stage ceased to be suitable as scale changed, without making the earlier choice a mistake.

For practitioners, the case separates product quality from deployment suitability. An engine can execute local analytical work effectively and still be the wrong foundation for a warehouse that requires distributed scale. PostHog’s change illustrates that distinction through an actual migration. The case supports choosing an architecture for how a workload is expected to change, since a deployment that works at first may not suit every later stage.

Where DuckDB's in-process model is the right answer, not a compromise

Notebook analytics, embedded application queries, and single-analyst workflows put DuckDB in its intended setting. The data fits on one machine, and the consumer works close to it. Local processing of Parquet, CSV, and JSON belongs here. In these cases, embedding the engine is not a concession made to avoid running a larger system. It removes infrastructure that the workload does not need.

The performance benefit comes with a simpler operating model. DuckDB skips the client-server serialization cost and network round-trip, and there is no separate database server to manage. Its integration with Python, Go, and other calling processes lets the application run analytical queries within its own boundary. That is a direct architectural fit. For analytical roles, it can therefore be the correct replacement for SQLite, Pandas, or a temporary PostgreSQL instance rather than a smaller substitute for a shared warehouse.

For a single analyst querying files already in memory, spreading that work across machines has no built-in benefit. The same holds for an embedded application that needs to do only local analytical work. In those settings, infrastructure management adds a requirement.

The DuckDB Foundation holds the core intellectual property and trademarks for DuckDB, DuckLake, and Quack, and states that those projects will continue under the MIT license. DuckLabs’ acquisition by AWS in August 2026 adds context to the ecosystem’s development. Together, these changes suggest that the open-source model will last, though growth in the ecosystem is separate from the ability to run distributed execution.

How the Postgres extensions landscape bridges the two engines for teams that want both

Postgres extensions bring the same architectural choice into an existing database environment. Teams can access analytical engines without treating a full migration as the only option. The decisive question remains where compute runs. An extension operating in the same process, one using the same host, and one sending work to a separate system consume resources in different places.

pg_duckdb places DuckDB’s analytical capabilities on the Postgres host. That can suit heavy aggregations and Parquet processing when the server has spare capacity. The trade-off appears when analytical load grows or transaction latency becomes important. Analytical execution then competes with OLTP queries for the host’s resources. Faster analytical execution does not, by itself, remove that competition.

A separate analytical system changes the resource boundary instead. It moves work away from the Postgres host, but introduces another system to operate and data to keep in sync. It keeps transactional work separate from a growing analytical service. For a team choosing an extension, compute placement is therefore a more useful first distinction than a feature-by-feature comparison.

LLM observability makes the distinction particularly clear. Logging prompts, completions, and execution traces at production volume produces a continuously growing dataset that multiple consumers need to query in real time. Those needs for scale and shared access are like the ones that drove PostHog’s changes. By contrast, DuckDB’s embedded-per-agent direction gives each agent instance its own engine for local analytical exchange. Agent-side computation and a shared, persistent, high-concurrency telemetry store are different jobs, even when both involve analytical queries.

A decision framework: matching deployment context to the right engine

The practical decision starts with scale, concurrency, infrastructure, and freshness requirements. A lower median on ClickBench is relevant only after those constraints define a plausible deployment. The workload must fit the execution model. DuckDB is the appropriate choice for local, single-analyst, notebook-based, or embedded tasks when the dataset fits on one machine and the task requires freedom from infrastructure management, with its strongest case being sub-second latency on files already in memory.

A shared analytical service may need to support substantial concurrent demand and growth beyond one machine. In that setting, the service boundary is necessary. The comparison must account for concurrent dashboard queries, the expected scale of the stored data, and an individual query’s duration. Freshness belongs in the same assessment. A continuously growing dataset queried by multiple consumers imposes a different operating requirement from local files used by one analyst.

DuckDB 2.0 extends the range of possible deployments without erasing that distinction. Its client-server mode through Quack brings shared access into the picture, while asynchronous I/O improves its reach toward cloud-resident workloads, including S3. These are meaningful extensions to its operating model. They do not make distributed scale a versioning gap that teams can assume a future release will close. Teams planning for petabyte-scale growth should not base that plan on such an assumption.

For teams retaining Postgres, the corresponding decision is whether analytical compute can share the transactional host or needs a separate system. That choice adds the costs of resource competition on one side and operation and synchronization on the other. ClickBench then helps assess latency within the appropriate category. Its query-level split is most useful when read as evidence about the deployment being considered, rather than as a universal ranking detached from the work the system must perform.

All posts