Re: Redundant sub query triggers slow nested loop left join

От: Tom Lane
Тема: Re: Redundant sub query triggers slow nested loop left join
Дата: ,
Msg-id: 13922.1177199288@sss.pgh.pa.us
(см: обсуждение, исходный текст)
Ответ на: Redundant sub query triggers slow nested loop left join  ("henk de wit")
Список: pgsql-performance

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

Redundant sub query triggers slow nested loop left join  ("henk de wit", )
 Re: Redundant sub query triggers slow nested loop left join  (Tom Lane, )
 Re: Redundant sub query triggers slow nested loop left join  ("henk de wit", )
  Re: Redundant sub query triggers slow nested loop left join  (Tom Lane, )
   Re: Redundant sub query triggers slow nested loop left join  ("henk de wit", )
    Re: Redundant sub query triggers slow nested loop left join  (Tom Lane, )
     Re: Redundant sub query triggers slow nested loop left join  ("henk de wit", )
      Re: Redundant sub query triggers slow nested loop left join  (Tom Lane, )
     Re: Redundant sub query triggers slow nested loop left join  ("henk de wit", )
 Re: Redundant sub query triggers slow nested loop left join  ("henk de wit", )
 Re: Redundant sub query triggers slow nested loop left join  ("henk de wit", )
 Re: Redundant sub query triggers slow nested loop left join  ("henk de wit", )

"henk de wit" <> writes:
> Naively I would say that a planner
> would have to be smart enough to see this by itself?

We got rid of direct tests for redundant WHERE clauses a long time ago
(in 7.4, according to some quick tests I just made).  They took a lot
of cycles and almost never accomplished anything.

Since you have two redundant tests, the selectivity is being
double-counted, leading to a too-small rows estimate and a not very
appropriate choice of join plan.

FWIW, CVS HEAD does get rid of the duplicate conditions for the common
case of mergejoinable equality operators --- but it's not explicitly
looking for duplicate conditions, rather this is falling out of a new
method for making transitive equality deductions.

            regards, tom lane


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

От: Tom Lane
Дата:
Сообщение: Re: Odd problem with planner choosing seq scan
От: Ulrich Cech
Дата:
Сообщение: Re: Large objetcs performance