Re: Removing unneeded self joins - Mailing list pgsql-hackers

From Jonathan S. Katz
Subject Re: Removing unneeded self joins
Date
Msg-id E238CD3A-993A-4FD1-8920-988B00C01478@postgresql.org
Whole thread Raw
In response to Re: Removing unneeded self joins  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
> On May 16, 2018, at 1:58 PM, Andres Freund <andres@anarazel.de> wrote:
>
> Hi,
>
> On 2018-05-16 12:26:48 -0400, Robert Haas wrote:
>> Also, I'm not sure that I believe that it's always easy to avoid
>> generating such queries.
>
> Yea. There's obviously plenty cases where ORMs just want to make the
> database hurt. But especially when building a join between a number of
> tables based on various fields, it's not going to be easy for the ORM to
> figure out which ones can be safely omitted. It'd need similar
> optimization as we'd have to do, without having the infrastructure core
> PG has.  And then there's, as you say, views etc…

Are there specific examples of what the ORM code is that generated
the SQL? I’m more curious to see what people are writing that
generates such code. As earlier mentioned we could always report back
to the specific ORM maintainer(s) such examples and see if they could
tweak.

Jonathan

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Removing unneeded self joins
Next
From: Arthur Zakirov
Date:
Subject: Re: [PROPOSAL] Shared Ispell dictionaries