Moving our warehouse off DuckDB

(posthog.com)

106 points | by emschwartz 2 hours ago

26 comments

  • 0c3ca83 2 hours ago
    Am I missing something here, or is the only technical detail in the post "a trillion rows is a lot of data, maybe trying trinio will work this time"?

    It feels like a lot of churn and not a lot of measurements or engineering.

    • Deukhoofd 42 minutes ago
      If I was a user of this product I'd be really worried about the "We rewrote our software 5 months ago, but that didn't solve the issue we wanted to solve so we're doing it again, maybe this time we'll fix it" message of this post.
      • eddythompson80 20 minutes ago
        Unironically, I think we will see a lot more of this given how engineering is being done currently. I have been involved in 2 green field projects in the last 2 years. Both have been rewritten or had massive "ship of theseus" type changes multiple times over that time window.

        Engineers working on new products, thanks to LLMs, have very little understanding of the technical details of the product. They have the same level of understanding a traditional high level manager had of products they owned. If you ever worked in an engineering org with an M2 or M3 who always attended your outage review, and in every outage review something has to involve some issue with Postgres or your Kafka queue, that disconnected M3 would conclude:

            "Almost every outage involves some problem with Postgres. My conclusion, observed over the last 6-12 months, Postgres is bad. I see this new FancyDB or DynamoDB thing is popular on Twitter. We should try that"
        
        I have lost count of the number of idiotic takes like that from M2s or M3s who have no idea how things work but instead focus on keywords they can latch onto that seems to be in the intersection of all issues. Then the logical solution is just to remove that and see what happens. This used to be very expensive, but if you can throw an LLM at a code base and say "Replace Postgres with FancyDB, split it to a list of logical checkpoints adding regression testing when missing to each checkpoint and open stacked PRs for all checkpoints", let it churn for an after noon, and 46k-line change PR (and $800 token bill) later you are ready to try FancyDB, why would you not give it a try? Then if you have issues with FancyDB, are you gonna spend the time to understand what's going on or just say "lets try DynamoDB next"?
        • antonvs 0 minutes ago
          > lets try DynamoDB next

          This is what this new feature called “loops” are for. Tell your agent to identify a list of databases and try them all, in prod, until it finds a good one. Be sure to tell it “no outages”.

    • lokar 1 hour ago
      To me to key “insight” is that if you are going to spin up single VMs (or even groups) per-customer and then route queries, you need to be able to estimate the query cost first.

      I know snowflake does this, they do the query optimization before sending it for execution. So it knows about how many resources will be needed (it can obviously be wrong).

      • gonzalohm 1 hour ago
        How does Snowflake use that information? You still need to pick the warehouse. It would be cool if there was an "elastic warehouse" where heavier queries are routed to bigger Warehouses, but that's not the case
        • lokar 8 minutes ago
          There is an elastic option, I think . Also, even with a specific warehouse, not every query uses every node in the warehouse.
    • coolgoose 2 hours ago
      I don't get the blog post either.
    • huqedato 1 hour ago
      This sounds more like: shoot first ask later. (OMG!)
    • dominotw 1 hour ago
      > It feels like a lot of churn and not a lot of measurements or engineering.

      They are big on shipping slop at lightnigg speed. So this is not surprising. Checkout posts by their ceo on cringedin.

      • andor 40 minutes ago
        The entire website is a bit of a red flag to me, starting with the cookie banner featuring an image of Ursula von der Leyen and some misinformation (cookie banners are not legally required).
  • Aurornis 2 hours ago
    > Five months ago, we rebuilt our warehouse on DuckDB instead of ClickHoue

    They switched from ClickHouse to DuckDB five months ago, then switched from DuckDB to their own Trino derivative?

    The article then ends before saying if the new setup solved their problems.

    It’s great that we can now make these migrations with little downtime (I assume?) and try different things, but I wish we could have read more about what testing they did before jumping. The fact that they jumped to DuckDB without realizing it wasn’t going to work at their scale and spent only a few months with it before jumping again is not convincing.

    I hoe there’s more to this story that just didn’t make it into the blog posts. As written it’s giving me flashbacks to some teams I worked with who changed tech stacks every six months because they liked migrating more than tuning and maintaining.

    • timgl 3 minutes ago
      Founder here -- this is about our warehouse product which is separate from our main analytics DB. Our DuckDB warehouse was used by a handful of pilot customers. Our clickhouse database is serving all of our analytical queries.
    • hinkley 37 minutes ago
      Things like this are a part of why I push back on people telling me we can do important things later. I don’t want to swap the engine out of a machine that’s moving that fast. There’s no time to learn about how it behaves with real versus synthetic traffic and what the failure modes are when you’re doing many thousands of transactions per second.

      Why wouldn’t you want to sort stuff like that out when the problem is still relatively small?

      The only other reasonable option is to wait until the problem gets so big that it splits into several domains. And then you can move one domain over, see how that goes, and move more over if it goes well.

      If you can’t know for certain how the system will behave under organic load that may mean migrating traffic onto the new system and then back to the old one several times, which means you need migrations in both directions and each transition is an opportunity for human error to destroy data or take the service offline.

    • renegade-otter 1 hour ago
      It reminds of people who use ORMs, never pop the hood to analyze the queries, indexes, etc - then decide it's the database that's the problem.
      • bunderbunder 33 minutes ago
        There are many good reasons why the industry largely moved away from having DBAs as a specialist position. But one downside I've seen is that it's increasingly common to have teams decide to just switch platforms without fully exploring whether that's really necessary.

        I'm not really surprised, data storage and data access technology is a pretty large subject all by itself, and a "jack of all, master of none" developer might never develop the expertise needed to properly optimize a database.

    • sgt 2 hours ago
      What's wrong with ClickHouse again?
      • kwillets 35 minutes ago
        I think it was closer to what they need; it comes down to keeping TB of data on local SSD and having a query engine next to it. That takes persistent, shared CPU, caching, sharding, resource management, etc.

        Duckdb is an interesting approach to resource management (all ephemeral), but TB's are TB's. I doubt it was finding data where it needed it.

        Clickhouse seems slow at getting to the top end of scaling; it's stuck with the 99% of its userbase doing 1 GB queries. I'm hoping they put some of their money into it.

      • Aurornis 2 hours ago
        I don’t know? They have blog posts about it but I don’t know how much I’d trust them because their chosen replacement only lasted 5 months before the next replacement.
      • vindex10 1 hour ago
      • spooneybarger 1 hour ago
        Unless something has changed in the last year, a lot of teams have serious problems with stability.
        • hinkley 35 minutes ago
          PostHog has listed a lot of job openings in the last couple of years. I figured growth but maybe it’s turnover.
        • throwaw12 1 hour ago
          I am curious to learn more about those issues, anyone have shared their experience publicly? would love to read
  • yukIttEft 4 minutes ago
    Not sure their singlenode customers will be happy with Trino

    https://benchmark.clickhouse.com/#system=+Hoaus|ucqs|Tuts&ty...

  • bitpush 2 hours ago
    > Five months ago, we rebuilt our warehouse [1] on DuckDB instead of ClickHouse.

    Why did they write this post if they had not even allowed things to settle. It sounds like someone wanted to claim victory (and promo?)

    https://posthog.com/blog/why-we-rebuilt-our-data-warehouse

    • crorella 1 hour ago
      The intro to that post is so bad: "PostHog's original data warehouse had a single goal: delay the moment a company needs to hire their first data engineer."

      It is not to serve high quality and timely data to make good decisions, is to avoid hiring a specific role, lol. So bad.

      • ecshafer 1 hour ago
        Ironically a good data engineer should probably let them avoid needing 3 different data warehouse systems within a year.
    • dcrazy 44 minutes ago
      This is the same company with intentionally annoying full-wrap bus ads on Muni. They are trying to capture mindshare.
    • wheelerwj 2 hours ago
      Engineers like to experiment and we get the benefit of learning from their experiences. Not sure why you’re upset.
      • ams92 5 minutes ago
        This sounds more like a 5 month POC that the engineer should have been able to prove sooner that DucksDB didn’t fit the use case.
      • ambicapter 1 hour ago
        Maybe it's the "me first" mindset you're bringing to engineering?
      • weego 2 hours ago
        I mean, mostly it just comes off as egregious self-indulgence to try one thing and then jump to "we built the solution ourselves!" when the problem is not novel at all. These things are just tiresome.
  • kwillets 1 hour ago
    Sometimes a company just isn't able to manage a data warehouse; I've worked for a few.

    I even phone screened with this one but couldn't cover their crazy quilt of requirements; at that time they were also looking for someone to rewrite the clickhouse optimizer, and they were stuck trying to reshard their cluster, which should take an afternoon.

    I still like the company because their business prop reminds me of what we were doing in 2009, a kind of federated analytics organization on a centralized data warehouse that enables a lot of tools to be developed quickly at large scale.

    But goddammit they keep picking these half-working platforms and flip-flopping from one to another. We were crushing millions of queries against 2T-row tables on Vertica in 2010, and it's only gotten better for customer-facing data apps, which is what Posthog is. The company doesn't seem to have a baseline of what to expect; the market is too saturated with slow tools that lower expectations.

  • hasyimibhar 1 hour ago
    I wonder if they have considered moving back to ClickHouse. ClickHouse Iceberg support has improved a lot over the past few months. You can easily run stateless ClickHouse on top of Iceberg. This solves the tenancy issue, and it can easily handle petabytes scale [1].

    [1] https://clickhouse.com/blog/jump-trading-uses-clickhouse-wit...

  • avree 2 hours ago
    Haven't seen Posthog's website in a while. Man, it's hideous.
    • stickfigure 1 hour ago
      I actually like the menus. They work great on mobile too.

      We built up all these UI conventions from decades of desktop development, then abandoned them for the web (and worse, electron). It's annoying learning a new convention for every website. We could do a lot worse than bringing back menus.

    • LawrenceKerr 2 hours ago
      I kind of liked the originality. It's what happens when you give software developers free reign on the marketing pages as well, I guess.

      But it seems to have gotten a re-skin recently, and I preferred the previous more pixelated version. Also, there used to be a way to render a "normal" version of the website, but I can't find it anymore.

    • dm03514 2 hours ago
      I use it as a free web analytics, the UX is so bad and convoluted, it's like a bad joke.
    • SlackingOff123 2 hours ago
      And what's with that bs cookie banner? If the only cookies are functional/essential, they don't need to show a cookie banner. If it's for analytics, then I should be able to reject it. Otherwise, it's just a dick-over.
    • mattmcal 2 hours ago
      I actually love this design but I nevertheless agree it's atrocious.
    • pnathan 1 hour ago
      really? I think its one of the best websites going these years.
  • heliosAtwork 10 minutes ago
    Now they have their "own flavor" of Trino and a brand new open table format called "HogLake". This gives the impression of making excuses with little introspection.

    It would be great to see their ducklake fork, their patches and github issues so the community can learn.

  • cpa 17 minutes ago
    The 2026 equivalent of 2016's "Why Uber Engineering Switched from Postgres to MySQL" ! https://www.uber.com/us/en/blog/postgres-to-mysql-migration/
  • whinvik 1 hour ago
    The key insight I am getting from this is that as migrations get easier to do with agents, there will be a lot more of them.

    But more importantly a lot of them will happen because we will all get more trigger happy to start one. On the other hand I also don't know if at scales like PostHog, a successful migration can be tested without doing all of it.

  • mvkel 1 hour ago
    This reminds me so much of when we would bring a new marketing leader and they would plant their flag by nuking all of the existing marketing automation processes to bring in theirs, with no net impact on the business. Bike shedding.
  • thisisauserid 2 hours ago
    Is Quack, the DuckDB client-server protocol, something that could have helped them with the scaling problems they encountered?
  • uutangohotel 1 hour ago
    I would have appreciated more technical details with methodologies and explicit failures observed. Oh and a human voice would be nice for a change.

    > Customers ran more complex queries than we expected

    Did the queries change after DuckDB was introduced? Did they do a study of query patterns that could have anticipated this ahead of time?

    > Predicting CPU and memory for a specific query was even harder.

    What attempts / methodologies were used to try this? What was hard? What failed?

    > We'd rather have contributed to the existing community and helped it grow. But we couldn't land changes as fast as we needed, so we ended up carrying patches in a fork

    This isn't a BAD approach per se. IME it's common (and necessary) for the large scale users of a platform to maintain a fork for their needs and work with the community and the maintainers to upstream changes when/if the community is ready to accept. That's called influencing. On the other hand, if you toss of a few slop grenades to the community and they reject you shouldn't be surprised. (Not suggesting that's what happening here but the defeatest conclusion may imply it?)

    > Missing reconnects and managing TTLs and idle connections at scale is hard

    Wonder if they tried pgdog?

  • 1a527dd5 1 hour ago
    I'm surprised at this. That is a lot of engineering effort without revealing why they chose they own format and chose to query it via Trino.
  • crorella 1 hour ago
    Feels off that only 5 months ago the company just migrated to DuckDB only to now move to something else.

    Who did the growth estimation of the data? This looks like an example of bad planning.

  • tmach32 2 hours ago
    Interestingly, it seems that a data lake is the hot new thing to build in house. Hell, we did it too. If you don't mind, I wrote up exactly what these new data lakes tend to look like: https://telemetrymachine.com/blog/the-new-state-of-the-art-i...
  • time0ut 1 hour ago
    The git repo [0] has a lot more of the technical details.

    [0] https://github.com/PostHog/hoglake

  • fhn 1 hour ago
    This post is pointless. Tells us how it went, show performance numbers, show benefits, resource usage, ease of use, etc.
  • sreekanth850 2 hours ago
    after 3 months, how we switched back to forked clickhouse.
  • jauntywundrkind 26 minutes ago
    One thing I really appreciate about CloudFlare blog posts is that often they show their work, by showing what tickets they opened, what improvements they land upstream. With this march across clickhouse, duckdb, now trino, I'd love to know what if any places the team worked with upstream, what improvements got tried.

    I'm pretty ok with the march across products myself. It felt like the big shift was from shared giant clickhouse to lots of duckdbs. I wonder what juggling many more clickhouses would have been like. Excited and hopeful to here more back on Trini, with hope!

    It's wild how many really really good data stacks are out there. Apache has been collecting some absolutely stellar projects. And it feels like the rest of world meaning everyone but China is kind of sleeping on a lot of these options. Maybe it's just that these projects often go out of their way to have a place for emblems, for who is using the project, but a lot of these have pretty wide ranges of companies using them.

    I do wish we were still in an age of company blogging, where people did talk more to the tech getting played with, talk to what's cooking in the shop. It's great to have these outreaches. There's so much tech and we are just so quiet about it! There's so much less signal to go off of, so much less shared awareness than the aughts and 10's.

  • npalli 1 hour ago
    This idiotic churn used to be restricted to front end devs and backend folks were spared. Thanks for Agents now every part of the stack is going to be in constant churn thanks to resume builders. At no point in the article did you get a sense they have a handle on what their problem is and why a certain technology and architecture would be a better fit. Just try it out, churn out, try it out.
  • Thaxll 2 hours ago
    Translation: frontier models are so good that we can rewrite our own warehouse infra.
  • mgfist 1 hour ago
    HogLake is quite the name ..
  • bhouston 1 hour ago
    6 months from now: We are moving our warehouse off of Trino + HogLake to newer technology XXX.

    This is ridiculous. Why can you not foresee such issues? Do you not do testing with mock data at the size you need? Migrating production between stacks so often means you are not getting new features in. This is pure churn.

  • tonpork 25 minutes ago
    [flagged]
  • sick_of_slop 1 hour ago
    [dead]