Technology1 min read

Why we're moving our warehouse off DuckDB

By · Published by Everything Blog

In short

PostHog decided to replace its new DuckDB-based warehouse architecture after discovering that single-node engines present severe operational challenges in the cloud. Running the engine as a managed service made estimating CPU and memory requirements difficult, while spilling queries to disk was far too slow. The platform also hit major scaling limits with its DuckLake lakehouse extension during large-scale testing. Additionally, supporting standard Postgres network connections over port 5432 introduced heavy operational overhead and complicated load balancing.

Key points

  • Single-node database engines create unpredictable resource provisioning challenges when d…: Single-node database engines create unpredictable resource provisioning challenges when deployed as managed multi-tenant cloud services.
  • Disk spilling and synchronous Amazon S3 data fetching proved too slow and costly for dema…: Disk spilling and synchronous Amazon S3 data fetching proved too slow and costly for demanding customer analytical workloads.
  • Providing native Postgres protocol access introduces complex load balancing issues and hi…: Providing native Postgres protocol access introduces complex load balancing issues and high connection maintenance overhead compared to standard HTTP interfaces.

Sources checked by our analysis pipeline: 1

Contents

Five months ago, we rebuilt our warehouse on DuckDB instead of ClickHouse. We did it because a shared ClickHouse cluster couldn't handle hours-long modeling queries, and it lacked a cost-based query optimizer. DuckDB gave every customer their own instance, and tools like dbt could connect over Postgres. We're still fans.

But we underestimated how big and complex our customers' workloads would get. We didn't want them to have just a good experience, we wanted the best experience you can get when you pay someone else to run your warehouse. It should work at any scale, at a fair price.

So we spent the last three months re-architecting it, this time without DuckDB.

DuckDB is brilliant on one machine

We love DuckDB. It's probably the best single-node tool for analyzing heaps of data, and that node can be your laptop. It's robust and reliable. It almost always finishes your query, and if it runs out of memory, it spills to disk.

The same features that are great locally gave us problems in the cloud. Customers ran more complex queries than…

Technology