Re: [HACKERS] Idea for speeding up uncorrelated subqueries

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Idea for speeding up uncorrelated subqueries
Дата
Msg-id 4444.933866039@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Idea for speeding up uncorrelated subqueries  (Bruce Momjian <maillist@candle.pha.pa.us>)
Ответы Re: [HACKERS] Idea for speeding up uncorrelated subqueries  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-hackers
Bruce Momjian <maillist@candle.pha.pa.us> writes:
> Yes, the subqueries need work.  We don't even do index lookups into the
> inner plan, only sequential.  Already on TODO.

Huh?  I don't follow that at all...

> The multiple query executions are not on the TODO list.  Not sure why
> this is happening here.

After looking at subselect.c I think I understand why --- InitPlans are
only for subqueries that are known to return a *single* reslt.  When you
have a subquery that might potentially return many, many tuples, you
need to scan through those tuples, so we use SubPlan tactics even if
there's not a query correlation.

But this neglects the cost of re-executing the subplan over and over.
Materializing the result should help, no?  (Of course there are cases
where it won't, such as when the subplan is just an unqualified select,
but most of the time it should be a win, I think...)
        regards, tom lane


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

Предыдущее
От: "Ewan Mellor"
Дата:
Сообщение: Re: [INTERFACES] Re: [HACKERS] Threads
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Idea for speeding up uncorrelated subqueries