Re: [HACKERS] Early evaluation of constant expresions (with PATCH)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Early evaluation of constant expresions (with PATCH)
Дата
Msg-id 24796.937964075@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Early evaluation of constant expresions (with PATCH)  (Bernard Frankpitt <frankpit@pop.dn.net>)
Ответы Re: [HACKERS] Early evaluation of constant expresions (with PATCH)  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-hackers
Bernard Frankpitt <frankpit@pop.dn.net> writes:
> The solution that I propose is to include code in the optimizer that
> picks functions with constant arguments out of a qualification
> clause, and evaluates them.

This is something I had on my own to-do list, and I'm glad to see
someone beat me to it.  But you've only done half the job: you
should also be folding operators with constant arguments.

Also, you need to be wary of functions like now() and random().
There probably isn't any other way to handle these than to add a
column to pg_proc flagging functions that can't be constant-folded.

> Finally, there is the question of where in the planner should the
> early evaluation occur.  It is not obvious to me where the best point
> is, I chose to put it in
> plan/initsplan.c:add_restrict_and_join_to_rels().

I believe it would be best to do it considerably earlier, specifically,
before cnfify().  It might even be worth running the code twice,
once before and once after cnfify.

Also, probably we should apply it to the targetlist as well as the qual.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Problems with src/pl/tcl/mkMakefile.tcldefs.sh.in in 6.5
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Early evaluation of constant expresions (with PATCH)