Re: Poor plan when using EXISTS in the expression list

From: Pierre Ducroquet <p(dot)psql(at)pinaraf(dot)info>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Poor plan when using EXISTS in the expression list
Date: 2018-10-04 20:00:35
Message-ID: 9121794.OZ4C6MeCCK@peanuts2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)psql(at)pinaraf(dot)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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-10-04 20:07:15 Re: Procedure calls are not tracked in pg_stat_user_functions / track_functions
Previous Message Robert Haas 2018-10-04 19:57:40 Re: executor relation handling