Re: Allowing join removals for more join types

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Allowing join removals for more join types
Дата
Msg-id 5403.1400857991@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Allowing join removals for more join types  (David Rowley <dgrowleyml@gmail.com>)
Ответы Re: Allowing join removals for more join types
Список pgsql-hackers
David Rowley <dgrowleyml@gmail.com> writes:
> I've just had a bit of a look at implementing checks allowing subqueries
> with unique indexes on the join cols being removed,

I'm a bit confused by this statement of the problem.  I thought the idea
was to recognize that subqueries with DISTINCT or GROUP BY clauses produce
known-unique output column(s), which permits join removal in the same way
that unique indexes on a base table allow us to deduce that certain
columns are known-unique and hence can offer no more than one match for
a join.  That makes it primarily a syntactic check, which you can perform
despite the fact that the subquery hasn't been planned yet (since the
parser has done sufficient analysis to determine the semantics of
DISTINCT/GROUP BY).

Drilling down into the subquery is a whole different matter.  For one
thing, there's no point in targeting cases in which the subquery would be
eligible to be flattened into the parent query, and your proposed list of
restrictions seems to eliminate most cases in which it couldn't be
flattened.  For another, you don't have access to any planning results for
the subquery yet, which is the immediate problem you're complaining of.
Duplicating the work of looking up a relation's indexes seems like a
pretty high price to pay for whatever improvement you might get here.
        regards, tom lane



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

Предыдущее
От: Sandro Santilli
Дата:
Сообщение: Re: postgres_fdw and connection management
Следующее
От: Matteo Beccati
Дата:
Сообщение: Re: uuid-ossp (Re: [pgsql-packagers] Postgresapp 9.4 beta build ready)