Re: Removing INNER JOINs

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Removing INNER JOINs
Дата
Msg-id CAApHDvpn=A+vXgu2jFiswn_RtbOspdqMVpBbkMhpCHrftUgAMA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Removing INNER JOINs  (David Rowley <dgrowleyml@gmail.com>)
Ответы Re: Removing INNER JOINs  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On 10 December 2014 at 23:04, David Rowley <dgrowleyml@gmail.com> wrote:

The bulk of my changes are in allpaths.c, planmain.c and planner.c. The critical change is query_planner() now returns a List instead of a RelOptInfo. I wasn't quite sure how else to handle this. Please also notice the change to make_one_rel(). This function is now called twice if remove_useless_joins() found 1 or more INNER JOINs to be possibly removable. in remove_useless_joins() the rels are not marked as RELOPT_DEADREL like they are with LEFT JOINs, they remain as RELOPT_BASEREL, only they have the skipFlags to mark that they can be removed when there's no FK triggers pending. A flag on PlannerGlobal is also set which will later force make_one_rel() to be called twice. Once for the join removal plan, and once for the "All Purpose" plan. query_planner() then returns a list of the RelOptInfos of those 2 final rels created by make_one_rel(). All the processing that previously got done on that final rel now gets done on the list of final rels. If there's more than 1 in that list then I'm making the root node of the plan an "AlternativePlan" node. On init of this node during execution time there is some logic which chooses which plan to execute. The code here just calls ExecInitNode() on the root node of the selected plan and returns that, thus skipping over the AlternativePlan node, so that it can't be seen by EXPLAIN or EXPLAIN ANALYZE.

I had left the previous patch a bit unpolished.
In the attached I've created a new source file for nodeAlternativePlan and also performed various cosmetic cleanups.

I'd be keen to know what people's thoughts are about the nodeAlternativePlan only surviving until the plan is initialised.

Regards

David Rowley
Вложения

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

Предыдущее
От: Deepak S
Дата:
Сообщение: List of table names of a DB
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: Parallel Seq Scan