Re: Poor plan when using EXISTS in the expression list - Mailing list pgsql-hackers

From Pierre Ducroquet
Subject Re: Poor plan when using EXISTS in the expression list
Date
Msg-id 9121794.OZ4C6MeCCK@peanuts2
Whole thread Raw
In response to Re: Poor plan when using EXISTS in the expression list  (Geoff Winkless <pgsqladmin@geoff.dj>)
List pgsql-hackers
On Thursday, October 4, 2018 4:46:26 PM CEST Geoff Winkless wrote:
> On Thu, 4 Oct 2018 at 13:11, Pierre Ducroquet <p.psql@pinaraf.info> wrote:
> > Our developpers ORM (Django's) sadly can not use EXISTS in the where
> > clauses
> > without having it in the expression part of the SELECT statement.
> 
> I don't know if this will be helpful to you (and I appreciate there's still
> the underlying PG issue), but there's a suggestion here that you can work
> around this using .extra()
> 
> https://stackoverflow.com/a/38880144/321161

Sure this helps when you know the trap and don't use the Exist support in 
Django, but this still mean any developer with Django may create a query that, 
on small volumes, will be a bit slow, and will blow up on big volumes. We 
sadly can not monitor every piece of code written by developers or imported in 
the dependencies.




pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: executor relation handling
Next
From: Andres Freund
Date:
Subject: Re: Procedure calls are not tracked in pg_stat_user_functions /track_functions