‹ BackHN Continuity

Thread

Training a 4B model to produce 81% faster query plans than Postgres

702 points · 144 comments · polyphilz

  1. 2001zhaozhao · · focus · HN ↗
    Engineer: "HELP, our production DB is frozen on this query that worked fine before!"

    Infra: "Hmm, let's check... Well would you look at that, it seems like your LLM query planner usually works and produces fast queries, but this time when you changed a variable name to trigger query rebuild, it happened to hallucinate and miss an index, would you mind re-running the LLM a few times until you get a faster query?"

    1. reval · · focus · HN ↗
      I’ve seen this happen to SQL Server many times. Every time the solution is a stored proc with the recompile option enabled.
      1. simondotau · · focus · HN ↗
        The answer to every problem is to rebuild statistics. (And never use stored procedures. It's just a shitty API layer in the worst language imaginable, sitting outside of source control. If you need an API layer, write it in a real language, ideally the one you're already using.)
        1. mr_toad · · focus · HN ↗
          In my experience with databases the answer is never never, and never always, and it’s almost always sometimes and maybe.
          1. simondotau · · focus · HN ↗
            That’s mostly occasionally accurate.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.