From: Gaetano Mendola <mendola@bigfoot.com>
To: Marius Andreiana <mandreiana@rdslink.ro>
Subject: Re: NOT IN query takes forever
Date: Tue, 03 Aug 2004 19:28:27 +0200
Message-ID: <410FCB3B.5050300@bigfoot.com> (raw)
In-Reply-To: <1091548963.6915.2.camel@marte.biciclete.ro>
References: <6EE64EF3AB31D5448D0007DD34EEB34101AF1A@Herge.rcsinc.local>
<1091548963.6915.2.camel@marte.biciclete.ro>
Marius Andreiana wrote:
> On Tue, 2004-08-03 at 08:05 -0400, Merlin Moncure wrote:
>
>>>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.
>
> Thank you, that did it!
>
> With
> shared_buffers = 3000 # min 16, at least max_connections*2, 8KB each
> sort_mem = 128000 # min 64, size in KB
128 MB for sort_mem is too much, consider that in this way each backend can
use 128 MB for sort operations...
Also shared_buffers = 3000 means 24MB that is not balanced with the 128MB
needed for sort...
Try to bump up 128 MB for shared_buffer ( may be you need to instruct your
OS to allow that ammount of shared memory usage ) and 24MB for sort_mem.
Regards
Gaetano Mendola
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: mendola@bigfoot.com, mandreiana@rdslink.ro
Subject: Re: NOT IN query takes forever
In-Reply-To: <410FCB3B.5050300@bigfoot.com>
* 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