Re: NOT IN query takes forever

From: "Scott Marlowe" <smarlowe(at)qwest(dot)net>
To: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
Cc: "Marius Andreiana" <mandreiana(at)rdslink(dot)ro>, pgsql-performance(at)postgresql(dot)org
Subject: Re: NOT IN query takes forever
Date: 2004-08-03 18:26:28
Message-ID: 1091557588.27166.94.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, 2004-08-03 at 10:10, Merlin Moncure wrote:
> > > 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
> >
> > it takes <3 seconds (my hardware is not server-class).
>
> Be careful...sort_mem applies to each connection and (IIRC) in some
> cases more than once to a connection. Of all the configuration
> parameters, sort_mem (IMO) is the most important and the hardest to get
> right. 128k (or 128MB) is awfully high unless you have a ton of memory
> (you don't) or you are running in single connection scenarios. Do some
> experimentation by lowering the value until you get a good balance
> between potential memory consumption and speed.

Minor nit, sort_mem actually applies to EACH sort individually, so a
query that had to run three sorts could use 3 x sort_mem.

Note that one can set sort_mem per backend connection with set
sort_mem=128000 if need be so as not to use up all the memory with other
backends.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Dennis Bjorklund 2004-08-03 18:35:36 Re: Performance Bottleneck
Previous Message Martin Foster 2004-08-03 18:05:04 Performance Bottleneck