Re: Index isn't used during a join.

От: Tom Lane
Тема: Re: Index isn't used during a join.
Дата: ,
Msg-id: 12877.1136993583@sss.pgh.pa.us
(см: обсуждение, исходный текст)
Ответ на: Re: Index isn't used during a join.  (Robert Creager)
Ответы: Re: Index isn't used during a join.  (Robert Creager)
Список: pgsql-performance

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

Index isn't used during a join.  (Robert Creager, )
 Re: Index isn't used during a join.  (Michael Fuhr, )
  Re: Index isn't used during a join.  (Robert Creager, )
  Re: Index isn't used during a join.  (Robert Creager, )
   Re: Index isn't used during a join.  (Michael Fuhr, )
    Re: Index isn't used during a join.  (Michael Fuhr, )
    Re: Index isn't used during a join.  (Robert Creager, )
     Re: Index isn't used during a join.  (Robert Creager, )
      Re: Index isn't used during a join.  (Michael Fuhr, )
     Re: Index isn't used during a join.  (Tom Lane, )
      Re: Index isn't used during a join.  (Robert Creager, )

Robert Creager <> writes:
> What I had thought is that PG would (could?) be smart enough to realize tha=
> t one query was restricted, and apply that restriction to the other based o=
> n the join.  I know it works in other cases (using indexes on both tables u=
> sing the join)...

The planner understands about transitivity of equality, ie given a = b
and b = c it can infer a = c.  It doesn't do any such thing for
inequalities though, nor does it deduce f(a) = f(b) for arbitrary
functions f.  The addition Michael suggested requires much more
understanding of the properties of the functions in your query than
I think would be reasonable to put into the planner.

            regards, tom lane


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

От: Bendik Rognlien Johansen
Дата:
Сообщение: Re: Slow query with joins
От: "Dave Dutcher"
Дата:
Сообщение: Showing Column Statistics Number