‹ BackHN Continuity

Thread

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

702 points · 144 comments · polyphilz

  1. Someone · · focus · HN ↗
    > I paid ~$800 to rent a 2x H100 SXM node from Lambda for ~95 hours, and ~$400 in OpenAI API fees to generate the Astra trajectory demonstrations.

    > a tiny 4B model went from not being able to understand the harness it was wrapped in, to achieving a 1.81x geometric mean speedup and a summed latency decrease of 44.7% across a workload of join-heavy SQL queries

    I can’t find it in the article (may have skimmed it too much), but I suspect they didn’t include those ~95 hours in the benchmark numbers.

    I think all database vendors know their query optimizers could do much better if they could afford to spend lots of time to derive query plans.

    ⇒ this may be useful for some workloads, but even then, can you afford to spend hours every now and then to update your 4B model to ensure it still picks a good query plan?

    1. bananaowl · · focus · HN ↗
      Could you stitch a specific query plan to your view?

      ‘create plan llm_optimized …’

      ‘create view foo (select x, y, z from table bar) with plan llm_optimized’

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.