DuckDB Scales: DuckDB for the Long-Tail of Workloads
TL;DR: DuckDB Scales is a new extension that lets DuckDB run distributed. This means that DuckDB can spread the work across many nodes to process large queries. DuckDB Scales is available now as a preview in the Amazon Athena service. We plan to release it as open source in H1 2027. In this blog post, we outline the motivation behind DuckDB Scales, explain the high-level architectural decisions and show how it scales.
Along this blog post, we also published a press release titled “DuckLabs Introduces DuckDB Scales, Extending DuckDB Analytics Beyond a Single Machine”.
Motivation
DuckDB was built from the ground up to be as efficient as possible on a single machine. To facilitate this, it uses every trick in the book: vectorized execution, morsel-driven parallelism, NUMA-awareness, larger-than-memory processing, and so on. Thanks to these, DuckDB can serve huge workloads using just a single server.
At the same time, we realize that at some point, it’s not always practical to confine queries to the capacity of a single machine. Global organizations and large science experiments often have datasets over 1 petabyte. And while only a small fraction of queries actually touch on large portions of this data, these 99th percentile queries, sitting in the “long-tail” of the query distribution, often generate the most value. Therefore, they deserve some attention from us here at DuckLabs. Our mission is to increase your confidence working with data, and telling people to look elsewhere for massive datasets does not help with that.

To make sure that DuckDB users can keep using DuckDB and its friendly SQL dialect, we built the DuckDB Scales extension that scales horizontally to support workloads in the petabyte range.
Architecture
DuckDB Scales works by using multiple nodes to scale out the computation. The data sits in object storage such as Amazon S3 in a data lake format, DuckLake or Iceberg.
On a high level, the coordinator splits an optimized logical plan into stages and tracks when each stage’s inputs are ready. Then, a worker node receives the task, a self-contained SQL statement over specific input files. The worker plans that statement locally and can use several threads to execute it. Workers hand off results between stages by writing files to shared object storage.
In the following, we highlight a few key characteristics and features of DuckDB Scales:
Speculative execution. Of course, we are aware of the performance advantage of single-node execution, so DuckDB Scales has a trick up its sleeve called “speculative execution”: when running a query, it runs the whole query on a single DuckDB process next to the coordinator and, a few seconds later, starts the distributed plan on the cluster. Whichever finishes first wins, and the other one is cancelled. For a small query, the distributed plan often never even starts. This way, you don’t waste precious time waiting for the cluster to finish a computation that could have been finished on a single machine.
Distributed aggregation. Consider an aggregation query that groups a large table by a column. First, each worker reads its share of the table’s files directly from object storage. While scanning, it pre-aggregates the rows into a partial result per group. In the exchange step, each worker writes these partial results back to object storage, split into buckets by a hash of the grouping column, so that all partial results for a given group land in the same bucket. In the next stage, each worker picks up a bucket and finalizes it, combining the partial results into the final aggregate values. Finally, the coordinator collects the finalized groups and returns the result to the client. Because the exchange happens entirely through files on object storage, the workers never talk to each other directly, and a failed task can simply be rerun.
Fault-tolerance and robustness. DuckDB Scales guarantees fault-tolerance by retrying failed tasks, which is simple because workers exchange all intermediate results through files on object storage instead of communicating directly. Tasks in Scales are idempotent and delivered with at least once semantics. Each task is a SQL query that reads from object storage and writes its output back, so running it twice does no harm. Whichever attempt commits first wins, and the others’ output is discarded. DuckDB Scales can also handle skewed data distribution, a common pitfall for distributed query execution algorithms.
Feature-richness. DuckDB Scales can handle complex queries with joins, window functions, aggregations on a large number of groups. We ran extensive internal tests with the TPC-H and TPC-DS workloads along with other benchmarks and test suites.
Performance
We benchmarked DuckDB Scales using the queries of the well-known TPC-H benchmark, which models the analytical queries that a wholesale supplier would use. We used the scale factor 100,000 dataset, which corresponds to 100 TB of CSV files, and has about 866 billion rows of data in total.
The benchmark ran on AWS Graviton4 EC2 instances using S3 Express One Zone as the object storage. The coordinator node was an r8g.16xlarge instance (64 vCPU, 512 GiB, 30 Gbps network), while the worker nodes were r8g.8xlarge instances (32 vCPU, 256 GiB memory, 15 Gbps network).
Scalability Test
We conducted a scalability test using the aggregation-heavy Q1 on TPC-H SF100,000 and found that it scaled close to linearly. When running 64 workers, DuckDB Scales took 37.5 seconds, on 128 workers, it took 21.1 seconds (1.78× speedup) and on 256 workers, it took 11.1 seconds (3.38× speedup, i.e., 84% efficiency).
To illustrate the speed of processing, we’d like to point out one measurement: end-to-end, DuckDB Scales was running scans at a total speed of about 54 billion rows per second (!).
TPC-H Queries on 256 Nodes
A little over a year ago, we ran the TPC-H queries on single-node DuckDB 1.4 LTS using the SF100,000 dataset. We used an i8g.48xlarge EC2 instance (192 vCPU, 1.5 TB RAM, 45 TB of NVMe in RAID-0). Back then, we wrote on the DuckDB Engineering blog that “DuckDB completed all 22 queries of the benchmark using its larger-than-memory processing. […] The median query runtime was 1.19 hours.”
Today, we are happy to report that we ran the workload using DuckDB Scales on a cluster of 256 nodes and the queries finished with a median runtime of 57.1 seconds. Here’s a breakdown of the individual query runtimes:
So, DuckDB could indeed run these queries a year ago but most of them took longer than an hour and now it can run them using a cluster and most queries take less than a minute. This lets DuckDB users run their most demanding queries on a cluster of machines, unlocking completely new use cases for DuckDB.
Availability
The DuckDB Scales system is currently available in Amazon Athena as a preview release. Our long-term goal is to make DuckDB Scales work wherever your DuckDB runs – in the cloud, on premises, or on portable devices. We are first releasing it as part of Amazon Athena as the single deployment environment allows us to focus on getting the distributed engine right. We plan to open-source DuckDB Scales in H1 2027 with comprehensive documentation.
Frequently Asked Questions
You probably have many questions on DuckDB Scales. Here, we collected the most common ones for you.
How does DuckDB Scales store data?
DuckDB Scales uses open lakehouse formats (DuckLake or Iceberg). The data sits on object storage. Workers write data files in parallel, and the coordinator does one metadata commit per statement.
Is DuckDB Scales an ideal choice for many small queries?
No. Each query has a fixed cost of a few hundred milliseconds, so plain DuckDB is faster for small ones.
That said, DuckDB Scales' speculative execution feature helps with answering small queries quickly: the local run will complete first.
Does DuckDB Scales use DuckLake?
DuckDB Scales uses DuckLake as the default table format but it also works with Iceberg.
Does DuckDB Scales use Quack?
DuckDB Scales can use Quack for communication between the coordinator and the workers but it’s not the only option. For example, DuckDB Scales can deploy worker nodes on a fleet of Firecracker microVMs, where communication happens with separate task queues. We are also working on further deployment options – stay tuned.
Can DuckDB Scales run updates?
Yes, DuckDB Scales can run updates (INSERT, DELETE, UPDATE, etc.). Currently, in the Amazon Athena service, this is supported over Iceberg tables in Glue Data Catalog.