Обсуждение: Semantic optimization is posible?

Поиск
Список
Период
Сортировка

Semantic optimization is posible?

От
Sebastián Ávila
Дата:
Hello people,

I'm thinking to add a stage before the optimizer and after the parser
with a basic rewriter in order to flatten all nested queries using a
pattern and table statistics, here I also can use assetions the
database have. Another and complementary possibility is that I can
make annotations on the query's data structure so that a later stage
can use the semantic info to either prune the search space or to pick
a specific query execution strategy.
Summarizing, I want to add semantic optimization into the query
processing execution.

I need to hear your opinion and your ideas about this, because I have
to choose between this project about semantic optimization and other
about software analysis. My problem is that I don't know how much
dificult can be to do semantic optimization and to do it well. What is
your opinion about? I have to implement the project in 5 months.

Thank you to all!!


Re: Semantic optimization is posible?

От
Martijn van Oosterhout
Дата:
On Mon, Oct 24, 2005 at 12:11:55PM +0200, Sebastián Ávila wrote:
> Hello people,
>
> I'm thinking to add a stage before the optimizer and after the parser
> with a basic rewriter in order to flatten all nested queries using a
> pattern and table statistics, here I also can use assetions the
> database have. Another and complementary possibility is that I can
> make annotations on the query's data structure so that a later stage
> can use the semantic info to either prune the search space or to pick
> a specific query execution strategy.
> Summarizing, I want to add semantic optimization into the query
> processing execution.
>
> I need to hear your opinion and your ideas about this, because I have
> to choose between this project about semantic optimization and other
> about software analysis. My problem is that I don't know how much
> dificult can be to do semantic optimization and to do it well. What is
> your opinion about? I have to implement the project in 5 months.

Why does it need to be a seperate stage? It is "optimising" right, so
why wouldn't it be part of the "optimizer"?

Currently things like pulling up subqueries, expanding immutable
functions, flattening and reordering joins are all done in the
optimiser. Looks like your stuff should be too...

AIUI, mosts parts of the optimiser deal with questions like: give me
the best plan to evaluate <expression>. So if you're dealingwith say an
EXCEPT node, you can add your special checks to see if it can work a
better way. If it can, evaluate the cost of the plan and compare it
with other possibilites. Eventually you return the best plans.

Note, generally you return sets of plans because which plan is best may
depend on what uses it. A "LIMIT 1" plan may require a completely
different strategy to a full scan plan, but you don't generally know
that down at the lower levels.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.