pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: SZUCS Gábor <surrano@mailbox.hu>
To: pgsql-performance@postgresql.org
Subject: Re: *very* inefficient choice made by the planner (regarding
Date: Fri, 18 Jun 2004 10:37:40 +0200
Message-ID: <008501c4550f$87523a80$0403a8c0@fejleszt4> (raw)
References: <200406101624.21739.ftm.van.vugt@foxi.nl>
	<40C881FE.5000301@sympatico.ca>
	<25304.1086883145@sss.pgh.pa.us>
	<40C892BA.8080704@sympatico.ca>
	<20040610100332.D20710@megazone.bigpanda.com>
	<20040610101410.X21002@megazone.bigpanda.com>

Dear Gurus,

----- Original Message ----- 
From: "Stephan Szabo" <sszabo@megazone.bigpanda.com>
Sent: Thursday, June 10, 2004 7:14 PM


>
> On Thu, 10 Jun 2004, Stephan Szabo wrote:
>
> >
> > On Thu, 10 Jun 2004, Jean-Luc Lachance wrote:
> >
> > > I agree, but it should be a simple rewrite. No?
> >
> > It's NULLs inside the subselect that are the issue.
> >
> > select 1 in (select a from foo)
> > select exists ( select 1 from foo where a=1)

Just a dumb try :)

  SELECT (exists(select 1 from foo where a isnull) AND NULL)
       OR exists(select 1 from foo where a=1)

AFAIK this returns
* NULL if (NULL in foo.a) and (1 not in foo.a)
* (1 in foo.a) otherwise.

The weakness is the doubled exists clause. I'm sure it makes most cases at
least doubtful...

G.
%----------------------- cut here -----------------------%
\end




view thread (12+ messages)  latest in thread

Message-ID: <008501c4550f$87523a80$0403a8c0@fejleszt4>
Permalink:  ../008501c4550f$87523a80$0403a8c0@fejleszt4/
Also on:    postgresql.org/message-id/008501c4550f$87523a80$0403a8c0@fejleszt4

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: surrano@mailbox.hu
  Subject: Re: *very* inefficient choice made by the planner (regarding
  In-Reply-To: <008501c4550f$87523a80$0403a8c0@fejleszt4>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox