pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dimitri Fontaine <dfontaine@hi-media.com>
To: pgsql-performance@postgresql.org
Cc: Scott Marlowe <scott.marlowe@gmail.com>
Cc: Flavio Henrique Araque Gurgel <flavio@4linux.com.br>
Subject: Re: work_mem in high transaction rate database
Date: Wed, 4 Mar 2009 10:16:07 +0100
Message-ID: <200903041016.09765.dfontaine@hi-media.com> (raw)
In-Reply-To: <dcc563d10903031737ne79c349r4740dbad68e04640@mail.gmail.com>
References: <29144661.96951236126415852.JavaMail.root@mail.4linux.com.br>
	<30792576.96971236126536868.JavaMail.root@mail.4linux.com.br>
	<dcc563d10903031737ne79c349r4740dbad68e04640@mail.gmail.com>

Hi,

On Wednesday 04 March 2009 02:37:42 Scott Marlowe wrote:
> If some oddball query really needs a lot of work_mem,
> and benchmarks show something larger work_mem helps, consider raising
> the work_mem setting for that one query to something under 1G (way
> under 1G) That makes it noticeably faster.  Don't allocate more than a
> test shows you helps.

The probably easiest way to integrate this into an existing application is 
this way, in my experience:

 BEGIN;
  SET LOCAL work_mem TO '650MB';
  SELECT -- the query requiring such a large setting
 COMMIT;

Right after the commit the global configured work_mem (or the previous 
session's one, in fact) will be in effect, you won't have to reset it yourself.

Regards,
-- 
dim

Attachments:

  signature.asc (application/pgp-signature, 196B) download

view thread (7+ messages)  latest in thread

Message-ID: <200903041016.09765.dfontaine@hi-media.com>
Permalink:  ../200903041016.09765.dfontaine@hi-media.com/
Also on:    postgresql.org/message-id/200903041016.09765.dfontaine@hi-media.com

 · 

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: dfontaine@hi-media.com, scott.marlowe@gmail.com, flavio@4linux.com.br
  Subject: Re: work_mem in high transaction rate database
  In-Reply-To: <200903041016.09765.dfontaine@hi-media.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