Re: PostgreSQL Tuning Results

From: "Ron Mayer" <ron(at)intervideo(dot)com>
To: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>, "Gavin Sherry" <swm(at)linuxworld(dot)com(dot)au>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PostgreSQL Tuning Results
Date: 2003-02-12 12:35:16
Message-ID: POEDIPIPKGJJLDNIEMBEGEDMCBAA.ron@intervideo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-advocacy pgsql-hackers


Christopher Kings-Lynne wrote:
>
>I reckon that sort_mem is the hardest thing to optimise1
>

Agreed... in part because it depends a lot on the query.

Also, if I understand correctly sort_mem not only affects sorts
but also hash table stuff as well, right? If that's true for
the new hash aggregates, I think this means large sort_mem settings
will become even more useful for data-warehouse-type applications.

One thing I've been wondering, is if "sort_mem" could be
per connection/backend-process instead of per sorting operation
so that sort_mem could be set more aggressivelly without running out
of memory so easily with large queries.

If that's not possible (i.e. one couldn't know how many simultaneous
sorts are needed beforehand), how about only let the first one or
two get all the memory and make the rest use a smaller one.

Anecdote:
I have a reasonably large data warehouse (1e6 to 1e8 rows
in various tables) with quite a bit of data (500k rows) added
each day. A lot of processing (7 hours/day) is spent loading
data and generating various aggregates. In a couple places
in the ETL part of the data warehouse code I have:

set sort_mem = 250000;
/// something that only needs a single sort
set sort_mem = 65536;
...
set sort_mem = 4096;
/// some ugly aggregate-creating join generated by a reporting tool
set sort_mem = 65536;

Ron

In response to

Responses

Browse pgsql-advocacy by date

  From Date Subject
Next Message Robert Treat 2003-02-12 16:36:19 Re: Changing the default configuration
Previous Message Hans-Jürgen Schönig 2003-02-12 07:49:07 Re: [HACKERS] PostgreSQL Tuning Results

Browse pgsql-hackers by date

  From Date Subject
Next Message Vatamanescu Victor 2003-02-12 12:56:56 Re: PostgreSQL Windows port strategy
Previous Message Jean-Michel POURE 2003-02-12 12:33:17 PostgreSQL Windows port strategy