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.
Training a 4B model to produce 81% faster query plans than Postgres
51–60 of 118 posts
Re: Training a 4B model to produce 81% faster query plans than Postgres
#52Infra: "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?"
Re: Training a 4B model to produce 81% faster query plans than Postgres
#53Earlier quoted context omitted.
This immediately halves your throughput.
Only in the worst case when the plans are equivalent: If one plan is significantly faster, then it'll finish first, and the loser can get canceled before it finishes.
Re: Training a 4B model to produce 81% faster query plans than Postgres
#54Earlier quoted context omitted.
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.
The immediate problem: How do you know which one is better without running them?
Re: Training a 4B model to produce 81% faster query plans than Postgres
#55Re: Training a 4B model to produce 81% faster query plans than Postgres
#56“81% faster query plans than Postgres”…on an 8 GB dataset that fits entirely in memory, with shared_buffers constrained to a fraction of that, queries warmed before measuring, and read-only SELECTs. I would be cautious about over fitting, it’s tough to say if those query plans would really be more optimal than Postgres heuristics at scale and with a bit more realistic OLTP workloads. In any case, such is life with pr…
At a certain point we should seriously talk about CUDA accelerating Postgres instead.
Re: Training a 4B model to produce 81% faster query plans than Postgres
#57Optimal 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.
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.
Re: Training a 4B model to produce 81% faster query plans than Postgres
#58“81% faster query plans than Postgres”…on an 8 GB dataset that fits entirely in memory, with shared_buffers constrained to a fraction of that, queries warmed before measuring, and read-only SELECTs. I would be cautious about over fitting, it’s tough to say if those query plans would really be more optimal than Postgres heuristics at scale and with a bit more realistic OLTP workloads. In any case, such is life with pr…
With a 4B parameter model that probably ran through 8GBs of RAM multiple times to run. At a certain point we should seriously talk about CUDA accelerating Postgres instead.
Re: Training a 4B model to produce 81% faster query plans than Postgres
#59But how will you know that the query plan actually does what your query asked for?