Re: Predicate migration on complex self joins

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Simon Riggs" <simon(at)2ndQuadrant(dot)com>, "pgsql-hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Predicate migration on complex self joins
Date: 2009-07-13 17:28:09
Message-ID: 4A5B28590200002500028720@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-07-13 17:33:07 Re: Predicate migration on complex self joins
Previous Message Andrew Dunstan 2009-07-13 17:16:49 Re: Upgrading our minimum required flex version for 8.5