Re: temporary memory configuration

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
Cc: "pgSQL - General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: temporary memory configuration
Date: 2008-11-06 01:55:31
Message-ID: dcc563d10811051755r7be1c899yf2c9f36467554acf@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Nov 5, 2008 at 8:09 AM, Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com> wrote:
> hey folks,
>
> so suppose I have a query that in explain analyze
>
> Sort Method: external merge Disk: 218080kB
>
> What param should I set to high up, to end up with that sort in memory, and

work_mem

> also - will that memory will always be allocated per connection,

It is allocated PER SORT, up to the amount needed. Note that you can
set work_mem for a given connection to override the default setting,
so you don't have to set workmem to 256M for everybody, but just this
one operation. You can also set default work_mem per user and per
database.

> (I am bit
> worried that having say 320MB of temporary memory space per connection will
> reduce number of possible connections). The query is not run quite often,
> but it would be nice to see it running faster, as it is a report type of
> query - and these ppl are usualy very unpatient. Currently it runs around
> 1-2 minutes with 1-6M rows to process join etc across 2-3 tables.

Definitely look at setting it in this connection at run time then.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Stark 2008-11-06 03:22:00 Re: Storage location of temporary files
Previous Message Webb Sprague 2008-11-06 00:34:26 Re: Read only access, via functions only