Re: Allow sorts to use more available memory

From: Andy Colson <andy(at)squeakycode(dot)net>
To: Robert Schnabel <schnabelr(at)missouri(dot)edu>
Cc: pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Allow sorts to use more available memory
Date: 2011-09-12 17:47:54
Message-ID: 4E6E45CA.20606@squeakycode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 9/12/2011 12:33 PM, Robert Schnabel wrote:
> The recent "data warehouse" thread made me think about how I use
> work_mem for some of my big queries. So I tried SET work_mem = '4GB' for
> a session and got
>
> ERROR: 4194304 is outside the valid range for parameter "work_mem" (64
> .. 2097151)
>
> A bit of searching turned up the "Allow sorts to use more available
> memory" section of the to-do list. Am I correct in reading that the
> max_val is 2GB and regardless of how much RAM I have in the box I'm
> stuck with only using 2GB? Am I missing something?
>
> I'm using: PostgreSQL 9.0.4, compiled by Visual C++ build 1500, 64-bit
> Windows 2008 Server Enterprise
>
> Thanks,
> Bob
>
>
work_mem is not the total a query can use. I believe each step can use
that much, and each backend can use it for multiple bits. So if you had
two backends, each doing 2 sorts, you'd use 2*2 = 4 * 2GB = 8GB.

-Andy

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Shaun Thomas 2011-09-12 17:57:58 Re: Allow sorts to use more available memory
Previous Message Robert Schnabel 2011-09-12 17:33:33 Allow sorts to use more available memory