From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com> |
Cc: | Greg Stark <gsstark(at)mit(dot)edu>, Cristian Prieto <cristian(at)clickdiario(dot)com>, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Any way to optimize GROUP BY queries? |
Date: | 2005-12-20 21:44:47 |
Message-ID: | 6542.1135115087@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
"Jim C. Nasby" <jnasby(at)pervasive(dot)com> writes:
> On Mon, Dec 19, 2005 at 03:47:35PM -0500, Greg Stark wrote:
>> Increase your work_mem (or sort_mem in older postgres versions), you can do
>> this for the server as a whole or just for this one session and set it back
>> after this one query. You can increase it up until it starts causing swapping
>> at which point it would be counter productive.
> Just remember that work_memory is per-operation, so it's easy to push
> the box into swapping if the workload increases. You didn't say how much
> memory you have, but I'd be careful if work_memory * max_connections
> gets very much larger than your total memory.
It's considered good practice to have a relatively small default
work_mem setting (in postgresql.conf), and then let individual sessions
push up the value locally with "SET work_mem" if they are going to
execute queries that need it. This works well as long as you only have
one or a few such "heavy" sessions at a time.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Juan Casero | 2005-12-21 00:50:47 | Re: What's the best hardver for PostgreSQL 8.1? |
Previous Message | Vivek Khera | 2005-12-20 21:08:20 | Re: What's the best hardver for PostgreSQL 8.1? |