Re: NOT IN query takes forever

From: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
To: "Marius Andreiana" <mandreiana(at)rdslink(dot)ro>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: NOT IN query takes forever
Date: 2004-08-03 12:05:23
Message-ID: 6EE64EF3AB31D5448D0007DD34EEB34101AF1A@Herge.rcsinc.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance

> Trying to run this query:
> EXPLAIN ANALYSE
> select * FROM trans
> WHERE query_id NOT IN (select query_id FROM query)
>
> but it will remain like that forever (cancelled after 30 min).

explain analyze actually runs the query to do timings. Just run explain
and see what you come up with. More than likely there is a nestloop in
there which is causing the long query time.

Try bumping up shared buffers some and sort mem as much as you safely
can.

Merlin

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert Treat 2004-08-03 13:36:52 Re: [ANNOUNCE] == PostgreSQL Weekly News - August 1st
Previous Message yoursoft@freemail.hu 2004-08-03 12:05:08 User locking

Browse pgsql-performance by date

  From Date Subject
Next Message Stephan Szabo 2004-08-03 14:03:31 Re: NOT IN query takes forever
Previous Message Lending, Rune 2004-08-03 09:09:26 pg_autovacuum parameters