Re: Predicate migration on complex self joins
От | Simon Riggs |
---|---|
Тема | Re: Predicate migration on complex self joins |
Дата | |
Msg-id | 1247508400.11347.1132.camel@ebony.2ndQuadrant обсуждение исходный текст |
Ответ на | Re: Predicate migration on complex self joins (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Predicate migration on complex self joins
Re: Predicate migration on complex self joins |
Список | pgsql-hackers |
On Mon, 2009-07-13 at 13:33 -0400, Tom Lane wrote: > 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. Yeh, damn ORMs seem to spring up faster than vines. Not just because of this but I wonder if we might benefit from an optimizer setting specifically aimed at the foolishnesses of automatically generated SQL. -- Simon Riggs www.2ndQuadrant.comPostgreSQL Training, Services and Support
В списке pgsql-hackers по дате отправления: