‹ BackHN Continuity

Thread

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

702 points · 144 comments · polyphilz

  1. hamilyon2 · · focus · HN ↗
    Optimal plan construction is math-heavy, algorithm-heavy and vary even by workload. There are options like creating just-in-time indexes, so solution space grows even faster than article presents. Sometimes it is the query planner which is the slow part of total execution time.

    LLM is kind of blunt weapon to use here. I am waiting rather for alphago style neural net heuristic.

    1. yipinwong · · focus · HN ↗
      What if we use a hybrid model of using both query optimizer and LLM? Whichever produces better result, the database can use?

      - a question from someone with lack of DB depth, me.

      1. jaggederest · · focus · HN ↗
        This is about to bake your noodle:

        <a href="https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;current&#x2F;geqo-pg-intro.html" rel="nofollow">https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;current&#x2F;geqo-pg-intro.html

        1. Sesse__ · · focus · HN ↗
          GEQO is not to get a better plan than the traditional optimizer, it is to be able to get a plan at all when the query is large. And it&#x27;s widely known for creating poor plans.
          1. jaggederest · · focus · HN ↗
            Yes, but it&#x27;s exactly the kind of hybrid between a regular planner and something generative (writ broadly) that they were asking about. Practically speaking if you&#x27;re hitting the GEQO you&#x27;ve already failed as a query writer unless it&#x27;s a purely OLAP on a dedicated beefy machine.
            1. Sesse__ · · focus · HN ↗
              I think calling GEQO generative is a bit of a stretch; it&#x27;s just a different way of searching through the same space with the same cost model. More or less devolving to “let&#x27;s take a bunch of randomized join orders and see which one is best” :-)

              And yes, large joins is definitely for OLAP use. If you have 20-way joins for OLTP, you&#x27;re either crazy or you&#x27;re using an ORM.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.