From: | Julius Stroffek <Julius(dot)Stroffek(at)Sun(dot)COM> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: Optimizer hook |
Date: | 2007-09-25 22:18:39 |
Message-ID: | 46F9893F.5070300@sun.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Well, It seems that I probably do not understand something quite well or
my explanation
is not clear. There is some example code of my idea in the attachment.
There is a function jos_search which has nearly the same code as
make_rel_from_joinlist.
The example tries geqo first and then the regular algorithm. At the
first sight it seems that
it is possible to do the same with the hook placed to the current
decision point. However,
the execution flow is slightly different.
1.) example in dummy.c
---
It first uses geqo only to find the cheapest path also for all the recursive
calls in jos_search. Afterwards, the same is executed using the regular
algorithm
also for all the recursive calls in jos_search. The whole result path
for the query
will be produced only by either geqo or regular algorithm.
2.) placing the hook to the current decision point and trying both
geqo®ular
at that place.
---
Parts of the result path might be found by geqo and parts of it by
regular algorithm.
The problem here is that regular algorithm will find the best plan every
time it finishes. However, the above is supposed to be used for the
algorithms
that none of them is supposed to find the best solution.
> That would be an entirely different problem, I think. If you want to
> replace the *entire* planner, there's already the planner_hook to do that.
>
Replacing the whole planner would need a much more code to be reused without
any change than in this case.
> you can't just willy-nilly replace the code for
> single-relation path selection, at least not without a whole lot of
> changes elsewhere in the planner infrastructure.
>
Would the code in dummy.c work in a way that I expect and explained above?
If there is no way of how to make the code work then it makes no sense
to put the hook to the place I am proposing. It works for me, but I have
not tested that very well yet. If I would swap calls to geqo
and make_one_rel_by_joins it will not work. Therefore there might be
an issue I do not know about yet.
> My thought was that the reason for this hook to exist was simply to
> provide a convenient way to replace only the join search order
> algorithm.
Yes, thats true. I do not have a plan to do something more for now.
Thank you
Regards
Julius Stroffek
Attachment | Content-Type | Size |
---|---|---|
dummy.c | text/x-csrc | 2.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-09-25 22:49:30 | Re: Optimizer hook |
Previous Message | Tom Lane | 2007-09-25 20:44:57 | Re: Optimizer hook |