Re: Predicate migration on complex self joins

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Predicate migration on complex self joins
Дата
Msg-id 26351.1247506387@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Predicate migration on complex self joins  (Simon Riggs <simon@2ndQuadrant.com>)
Ответы Re: Predicate migration on complex self joins  (Simon Riggs <simon@2ndQuadrant.com>)
Re: Predicate migration on complex self joins  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
Simon Riggs <simon@2ndQuadrant.com> writes:
> In some cases, we have SQL being submitted that has superfluous
> self-joins. An example would be

> select count(*) 
> from foo1 a, foo1 b 
> where a.c1 = b.c1 /* PK join */
> and a.c2 = 5 
> and b.c2 = 10;

> You may well ask who would be stupid enough to write SQL like that. The
> answer is of course that it is automatically generated by an ORM.

Seems like the right answer is "fix the damn ORM".  It's hard to believe
this sort of case comes up often enough to justify the cycles that would
be expended (on *every* join query) to try to recognize it.
        regards, tom lane


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

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: Predicate migration on complex self joins
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Predicate migration on complex self joins