Re: [HACKERS] EXISTS optimization

От: Martijn van Oosterhout
Тема: Re: [HACKERS] EXISTS optimization
Дата: ,
Msg-id: 20070323222641.GD9623@svana.org
(см: обсуждение, исходный текст)
Ответ на: Re: [HACKERS] EXISTS optimization  (Tom Lane)
Ответы: Re: [HACKERS] EXISTS optimization  ("Kevin Grittner")
Список: pgsql-performance

Скрыть дерево обсуждения

EXISTS optimization  ("Kevin Grittner", )
 Re: [HACKERS] EXISTS optimization  (Tom Lane, )
  Re: [HACKERS] EXISTS optimization  ("Kevin Grittner", )
   Re: [HACKERS] EXISTS optimization  ("Kevin Grittner", )
   Re: [HACKERS] EXISTS optimization  (Tom Lane, )
  Re: [HACKERS] EXISTS optimization  (Martijn van Oosterhout, )
   Re: [HACKERS] EXISTS optimization  ("Kevin Grittner", )
    Re: [HACKERS] EXISTS optimization  (Martijn van Oosterhout, )
 Re: [HACKERS] EXISTS optimization  ("Kevin Grittner", )
  Re: [HACKERS] EXISTS optimization  ("Craig A. James", )

On Fri, Mar 23, 2007 at 05:49:42PM -0400, Tom Lane wrote:
> We don't currently try to flatten EXISTS into a unique/join plan as we
> do for IN.  I seem to recall not doing so when I rewrote IN planning
> because I didn't think it would be exactly semantically equivalent,
> but that was awhile ago.  Right at the moment it seems like it ought
> to be equivalent as long as the comparison operators are strict.

Wasn't it due to the fact that IN needs to scan through all
possibilites anyway because of its interaction with NULL, whereas
EXISTS can stop at the first row?

That would mean the subquery to be materialised would not be equivalent
if it called any non-immutable functions. It's also much less clear to
be a win in the EXISTs case. But then, that's a costs issue the planner
can deal with...

Have a nice day,
--
Martijn van Oosterhout   <>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

В списке pgsql-performance по дате сообщения:

От: "Kevin Grittner"
Дата:
Сообщение: Re: [HACKERS] EXISTS optimization
От: "amrit angsusingh"
Дата:
Сообщение: Optimization postgresql 8.1.4 FC 6 X64 ?