Re: work_mem in high transaction rate database - Mailing list pgsql-performance

From Dimitri Fontaine
Subject Re: work_mem in high transaction rate database
Date
Msg-id 200903041016.09765.dfontaine@hi-media.com
Whole thread Raw
In response to Re: work_mem in high transaction rate database  (Scott Marlowe <scott.marlowe@gmail.com>)
List pgsql-performance
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

Attachment

pgsql-performance by date:

Previous
From: Akos Gabriel
Date:
Subject: Re: work_mem in high transaction rate database
Next
From: Flavio Henrique Araque Gurgel
Date:
Subject: Re: work_mem in high transaction rate database