pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <smarlowe@qwest.net>
To: Merlin Moncure <merlin.moncure@rcsonline.com>
Cc: Marius Andreiana <mandreiana@rdslink.ro>
Cc: pgsql-performance@postgresql.org
Subject: Re: NOT IN query takes forever
Date: Tue, 03 Aug 2004 12:26:28 -0600
Message-ID: <1091557588.27166.94.camel@localhost.localdomain> (raw)
In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB34101AF1C@Herge.rcsinc.local>
References: <6EE64EF3AB31D5448D0007DD34EEB34101AF1C@Herge.rcsinc.local>

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.




view thread (10+ messages)  latest in thread

Message-ID: <1091557588.27166.94.camel@localhost.localdomain>
Permalink:  ../1091557588.27166.94.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1091557588.27166.94.camel@localhost.localdomain

 · 

reply

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: smarlowe@qwest.net, merlin.moncure@rcsonline.com, mandreiana@rdslink.ro
  Subject: Re: NOT IN query takes forever
  In-Reply-To: <1091557588.27166.94.camel@localhost.localdomain>

* 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