AI for query-planning?
Hi, are there any plans for using some kind of AI for query-planning?
Can someone with more knowledge about this than I have please explain why it
might, or not, be a good idea, and what the challenges are?
Thanks.
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
andreas@visena.com <mailto:andreas@visena.com>
www.visena.com <https://www.visena.com>
<https://www.visena.com>
On 6/22/24 04:50, Andreas Joseph Krogh wrote:
Hi, are there any plans for using some kind of AI for query-planning?
Can someone with more knowledge about this than I have please explain
why it might, or not, be a good idea, and what the challenges are?
1) Require large amount of resources.
2) Produce high rate of incorrect answers.
Thanks.
--
*Andreas Joseph Krogh*
CTO / Partner - Visena AS
Mobile: +47 909 56 963
andreas@visena.com <mailto:andreas@visena.com>
www.visena.com <https://www.visena.com>
<https://www.visena.com>
--
Adrian Klaver
adrian.klaver@aklaver.com
On Sat, Jun 22, 2024, 5:20 PM Andreas Joseph Krogh <andreas@visena.com>
wrote:
Hi, are there any plans for using some kind of AI for query-planning?
Can someone with more knowledge about this than I have please explain why
it might, or not, be a good idea, and what the challenges are?
https://github.com/ossc-db/pg_plan_advsr
https://github.com/s-hironobu/pg_plan_inspector
not totally ai, but it can use data from your database to build some
metadata.
there are also plan analyzers online which people paste their plan to get a
quick summary of problem areas, that data can be useful too for ai based
plan optimisers.
but that said, postgresql has a lot of knobs to tune, so ...
## Andreas Joseph Krogh (andreas@visena.com):
Hi, are there any plans for using some kind of AI for query-planning?
Actually, we do have our GEQO - Genetic Query Optimization - already
in the planner: https://www.postgresql.org/docs/current/geqo.html
As per the common taxomonies, genetic algorithms are part of the
larger "Artificial Intelligence" domain - they're just not part of
the current hype cycle (some of us still remember the early iterations
of neuronal networks, or fuzzy logic, or...).
Can someone with more knowledge about this than I have please explain why it
might, or not, be a good idea, and what the challenges are?
Just waving your hand and saying "AI" three times in a row does not
manifest an usable algorithm. Going the full way from a problem to be
understood and solved to algorithm to implementation requires more
effort - and especially with all the "hot off the hype press" ideas
that already fails in the very first stages. Remember just recently,
when some people were "predicting" that all databases would become
blockchains?
Regards,
Christoph
--
Spare Space
<div dir="auto">The current forms of “AI” have no concept of state or long term memory. On each invocation of the AI you have to tell it,</div><div dir="auto"><br></div><div dir="auto">This is a Postgres database.</div><div dir="auto"><br></div><div dir="auto">This is my database schema.</div><div dir="auto"><br></div><div dir="auto">These are the indexes I have.</div><div dir="auto"><br></div><div dir="auto">After providing that information the “AI” “might” generate a valid query for your particular database but it won’t be optimum. The AI doesn’t know how many rows are in each table, the physical media each table is on, or any other attributes about your database that would be used to calculate the cost of using an index or a table scan.</div><div dir="auto"><br></div><div dir="auto">So then you could make the jump that an “AI” should be ran locally and trained exclusively on your database. Now you are using a general purpose “AI” algorithm for a very specific task which would not be optimum. It would require constant retraining which would be computationally expensive. </div><div dir="auto"><br></div><div dir="auto">Then let’s say you want to write an “AI” algorithm just for Postgres. Now you have basically rewritten the current Postgres Optimizer in a round about way. </div><div dir="auto"><br></div><div dir="auto"><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jun 22, 2024 at 09:40 Adrian Klaver <adrian.klaver@aklaver.com> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">On 6/22/24 04:50, Andreas Joseph Krogh wrote:
<br>> Hi, are there any plans for using some kind of AI for query-planning?
<br>>
<br>> Can someone with more knowledge about this than I have please explain
<br>> why it might, or not, be a good idea, and what the challenges are?
<br>
<br>1) Require large amount of resources.
<br>
<br>2) Produce high rate of incorrect answers.
<br>
<br>
<br>>
<br>> Thanks.
<br>>
<br>> --
<br>> *Andreas Joseph Krogh*
<br>> CTO / Partner - Visena AS
<br>> Mobile: +47 909 56 963
<br>> andreas@visena.com <mailto:andreas@visena.com>
<br>> www.visena.com <https://www.visena.com&gt;
<br>> <https://www.visena.com&gt;
<br>
<br>--
<br>Adrian Klaver
<br>adrian.klaver@aklaver.com
<br>
<br>
<br>
<br></blockquote></div></div>