DuckDB 2.0 vs Polars 2.0: The 14x Gap Nobody’s Talking About

DuckDB 2.0 vs Polars 2.0: The 14x Gap Nobody’s Talking About

Real benchmarks on 100M rows reveal DuckDB 2.0 crushes Polars 2.0 at database reads by 14x, but Polars strikes back in streaming. Here’s what it means for your stack.

DuckDB 2.0 vs Polars 2.0 benchmark comparison on 100 million rows
DuckDB 2.0 vs Polars 2.0: Benchmarking on 100M rows

Three years ago, Polars 0.18 and DuckDB 0.9 went head to head and basically tied. The data engineering community shrugged, picked whichever matched their SQL-versus-DataFrame religion, and moved on. But now both projects have shipped their 2.0 releases, and Thomas Reid decided to run them through five real-world tests on datasets up to 335 million rows. The results aren’t a tie. Not even close.

Here’s the headline: DuckDB read a 100-million-row local Postgres table more than 14 times faster than Polars in the reported setup. Fourteen. Times. That’s not a marginal win, that’s the kind of gap that changes architectural decisions.

The Setup: Five Tests That Actually Matter

Before we get into the bloodsport, let’s talk methodology. Reid ran these tests on Windows, which matters more than you’d think. The tests were:

  1. Read and sum a 100M-row Postgres table
  2. Read and sum a local CSV
  3. Read Parquet from S3
  4. Write Parquet to S3
  5. Complex aggregations on a 335M-row dataset

None of this TPC-H benchmark theater with perfectly normalized data and no real-world mess. This is the stuff you actually do on a Tuesday afternoon.

The 14x Gap: It’s Not What You Think

Here’s where it gets interesting. The 14x gap wasn’t in query execution, it was in reading from Postgres. DuckDB read that 100-million-row table like it was nothing. Polars… didn’t.

The reason isn’t a fundamental flaw in Polars’ engine. It’s architectural. Polars doesn’t have a native Postgres reader. It relies on external engines, either ConnectorX or ADBC. Reid used ADBC, which does return Arrow record batches directly. Sounds fine in theory.

The reality is messier. Polars’ database reads can suffer from driver-level bottlenecks, particularly when results are processed in a Python loop. A developer in the Reddit discussion nailed it: if the read of the database output runs in a Python loop (which is common), performance falls off a cliff. The commenter noted that with python-mssql writing directly to Arrow format, they’ve seen impressively fast reads with Polars. But that’s the exception, not the default.

DuckDB, meanwhile, has direct Postgres integration baked in. It’s not calling out to heaven for help, it just reads the damn table.

The CSV Test: A Narrow Win for DuckDB

The local CSV read-and-sum test was closer. DuckDB edged out Polars, but neither embarrassed the other. This tracks with what you’d expect: both tools have mature CSV readers with multi-threaded parsing and type inference. When you’re reading from disk, I/O often dominates, and there’s only so much optimization you can do on top of that.

S3 Parquet: The Era of Good Feelings

Reading and writing Parquet from S3 was, frankly, boring. Both tools performed similarly, and the output files were comparable in size. This is the test where neither side can claim victory, which is itself a notable data point.

Here’s a thought worth holding onto: the modern data stack increasingly runs on object storage. If DuckDB and Polars both handle S3-hosted Parquet equally well, then the decision between them has to hinge on other factors, like how you query, what your team knows, and where the data actually lives.

The 335M Row Aggregation: It Depends on Who You Ask

At the extreme scale, 335 million rows, the results get murkier. DuckDB 2.0’s architectural improvements include a from-scratch SQL parser and better asynchronous I/O, which help with complex window functions and group-bys. DuckDB’s own benchmarks show version 2.0 was 6x faster than the 1.56 release on TPC-H SF300.

But Polars has its own story to tell. The Polars 2.0 high-performance architecture introduced streaming improvements that matter at scale. In a separate benchmark on 23 GB of S3-hosted CSVs running on a 2 GB RAM node, DuckDB completed complex window functions in 837 seconds by spilling to disk. Polars 2.0 failed with OOM errors because it lacked group_by spill-to-disk support. But once Polars 2.1 added it, the rerun finished in 438 seconds, nearly twice as fast as DuckDB.

Yes, the guy running that benchmark admits comparing Polars 2.1 to DuckDB 2.0 “isn’t really fair.” But it’s also the reality of tool selection: you’re not always comparing version to version. You’re comparing what works today.

SQL vs. DataFrame: The Divide That Won’t Die

The philosophical divergence between these tools hasn’t changed. DuckDB is SQL-centered. It expects you to think in tables, joins, and set operations. Polars is DataFrame-centered, with SQL as a first-class option in 2.0 but not the primary interface.

This isn’t cosmetic. It shapes how you write code, how you think about data modeling, and how easily you can explain your pipeline to a colleague. If your team speaks SQL, and most analytics teams do, DuckDB’s interface is immediately familiar. If you’re building Python applications that process data in a more programmatic style, Polars’ DataFrame API is genuinely more ergonomic.

The rise of both tools in modern data engineering pipelines suggests there’s room for both. But the 14x gap in database reads is a strong argument for DuckDB when your primary workload involves pulling from an operational database.

Beyond Performance: What the 2.0 Releases Actually Mean

Performance benchmarks are fun, but the 2.0 releases bring more than speed. DuckDB 2.0 introduced the Quack protocol, which addresses multi-writer limitations via an RPC interface over HTTP or Unix sockets. It added an agent mode designed to reduce LLM token usage in AI-assisted workflows, plus better async I/O for read_csv on remote storage.

Polars 2.0 has been positioning for the terabyte scale, with the comparison between Polars and pandas becoming increasingly lopsided. Polars Cloud supports distributed processing at scale. If you need to scale beyond a single machine without moving to a full warehouse, that matters.

The Verdict: It Depends on Your Data Gravity

Here’s my take, informed by the benchmarks but not enslaved to them.

Choose DuckDB 2.0 if:

  • Your data lives in Postgres or you frequently query operational databases
  • Your team is SQL-first
  • You need reliable out-of-core processing without babysitting memory settings
  • You want the simplicity of a single embedded database that reads everything

Choose Polars 2.0/2.1 if:

  • You’re building applications with complex, programmatic data transformations
  • Your data lives in files (Parquet, CSV) rather than databases
  • You need to scale to distributed processing via Polars Cloud
  • Your team is Python-native and DataFrame-native

The uncomfortable truth is that “which is faster” is the wrong question. The right question is “which is faster for the data I actually have.” The DuckDB 2.0 evolution as an embedded analytics engine and Polars’ streaming improvements suggest both tools are converging on the same problems from different directions.

The Takeaway

The 14x gap isn’t a referendum on Polars’ engine quality. It’s a reminder that benchmarks measure the entire path from data to result, including drivers, connectors, and the often-overlooked glue code. DuckDB’s direct Postgres integration is a feature, and it’s a feature that shows up meaningfully on real workloads. The real-world production use of DuckDB demonstrates that the embedded database has moved beyond toy workloads into serious enterprise territory.

But if your workloads are file-based and your codebase is Python-native, Polars will serve you well. The DuckDB efficiency in large-scale data format conversions and Polars’ 2.1 streaming fixes mean both tools handle big data on modest hardware.

The real lesson? Don’t benchmark on someone else’s hardware with someone else’s data. Run the comparison on your own workloads, on your own stack, with your own drivers. And if you’re pulling from Postgres, maybe schedule a few extra minutes for Polars. Or just use DuckDB.

Share:

Related Articles