Re: Damn slow query

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Magnus Naeslund(f)" <mag(at)fbab(dot)net>
Cc: Joe Conway <mail(at)joeconway(dot)com>, Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Damn slow query
Date: 2002-10-09 22:33:40
Message-ID: 200210092233.g99MXeH07489@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Magnus Naeslund(f) wrote:
> Joe Conway <mail(at)joeconway(dot)com> wrote:
> > "IN (subselect)" is notoriously slow (in fact it is an FAQ). Can you
> > rewrite this as:
> >
>
> ...
>
> Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> wrote:
> > Per FAQ suggestion, try something like
>
> ...
>
> Thanks alot, below are the results on your suggestions, quite an
> dramatic differance (but this is another box, faster, and running 7.3b2
> so the 45 minutes doesn't hold here, but it took more than 10 minutes
> before i stopped the original query).
>
> Is this an todo item, or should every user figure this out (yeah i know
> i should have read the FAQ when it went so totally bad).
> The NOT IN it seems quite natural here, but then again, i don't think as
> the db as you do :)

We already have a TODO item:

* Allow Subplans to use efficient joins(hash, merge) with upper variable

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Naeslund(f) 2002-10-09 22:39:44 Re: Damn slow query
Previous Message Magnus Naeslund(f) 2002-10-09 22:30:08 Re: Damn slow query