Re: [HACKERS] Slow - grindingly slow - query - Mailing list pgsql-hackers

From Theo Kramer
Subject Re: [HACKERS] Slow - grindingly slow - query
Date
Msg-id 382BA0FB.82D96E3C@flame.co.za
Whole thread Raw
In response to Re: [HACKERS] Slow - grindingly slow - query  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Slow - grindingly slow - query  (Brian Hirt <bhirt@mobygames.com>)
replication  ("Aaron J. Seigo" <aaron@gtv.ca>)
List pgsql-hackers
Tom Lane wrote:
> 
> Theo Kramer <theo@flame.co.za> writes:
> > The query is
> 
> >   select accountdetail.domain from accountdetail where
> >     accountdetail.domain not in
> >       (select accountmaster.domain from accountmaster);

This takes more than 5 hours and 30 minutes.

> Try something like
> 
>   select accountdetail.domain from accountdetail where
>     not exists (select accountmaster.domain from accountmaster where
>                 accountmaster.domain = accountdetail.domain);

This takes 5 seconds - wow!

> I believe this is in the FAQ...

Will check out the FAQs. Many thanks.
--------
Regards
Theo


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] compression in LO and other fields
Next
From: Vadim Mikheev
Date:
Subject: Re: [HACKERS] Slow - grindingly slow - query