Re: [HACKERS] Idea for speeding up uncorrelated subqueries

Поиск
Список
Период
Сортировка
От Vadim Mikheev
Тема Re: [HACKERS] Idea for speeding up uncorrelated subqueries
Дата
Msg-id 37AA5E35.66C03F2E@krs.ru
обсуждение исходный текст
Ответ на Re: [HACKERS] Idea for speeding up uncorrelated subqueries  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-hackers
Bruce Momjian wrote:
> 
> Isn't it something that takes only a few hours to implement.  We can't
> keep telling people to us EXISTS, especially because most SQL people
> think correlated queries are slower that non-correlated ones.  Can we
> just on-the-fly rewrite the query to use exists?

This seems easy to implement. We could look does subquery have
aggregates or not before calling union_planner() in
subselect.c:_make_subplan() and rewrite it (change 
slink->subLinkType from IN to EXISTS and add quals).

Without caching implemented IN-->EXISTS rewriting always
has sence.

After implementation of caching we probably should call union_planner()
for both original/modified subqueries and compare costs/sizes
of EXISTS/IN_with_caching plans and maybe even make
decision what plan to use after parent query is planned
and we know for how many parent rows subplan will be executed.

Vadim


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

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