Re: NOT IN query takes forever

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(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 14:03:31
Message-ID: 20040803065928.Y88907@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


On Tue, 3 Aug 2004, Marius Andreiana wrote:

> I just vacuum analyse'd the database.
>
> 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).
>
> My postgresql.conf is the default:
> # - Memory -
>
> shared_buffers = 1000 # min 16, at least max_connections*2,
> 8KB each
> #sort_mem = 1024 # min 64, size in KB
> #vacuum_mem = 8192 # min 1024, size in KB
>
> Should I adjust something?

Probably sort_mem. It's probably estimating that it can't hash the result
into the 1MB of sort_mem so it's probably falling back to some sort of
nested execution.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Matthew T. O'Connor 2004-08-03 14:19:32 Re: pg_autovacuum parameters
Previous Message Merlin Moncure 2004-08-03 12:05:23 Re: NOT IN query takes forever