Simon Riggs <simon(at)2ndQuadrant(dot)com> wrote:
> select count(*)
> from foo1 a, foo1 b
> where a.c1 = b.c1 /* PK join */
> 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.
We had to do something like that to get acceptable performance from
Sybase ASE. That code probably has not been changed since migrating
to PostgreSQL, and since we have a strong portability mandate, it
probably should be left alone, since the penalty for the extra join in
PostgreSQL is small and the penalty for not having it in Sybase ASE is
large.
In short, it would be a welcome optimization here, although (in our
case) a relatively minor one.
-Kevin