Re: Automatically setting work_mem

From: "Luke Lonergan" <llonergan(at)greenplum(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
Subject: Re: Automatically setting work_mem
Date: 2006-03-18 21:29:37
Message-ID: C041BBC1.1F780%llonergan@greenplum.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom,

On 3/17/06 12:18 PM, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> One user with ability to enter arbitrary SQL commands can *always* blow
> your resource planning away. Blaming such things on work_mem is
> seriously misguided.

Agreed - that's why we need to split this discussion into the two categories
of (1) scheduling for concurrency protection and (2) dynamic resource
allocation.

Topic (1) is best handled by statement queuing IMO and as demonstrated by
other commercial DBMS. This allows queues of different resource demands to
be used for ensuring that statements can not over consume memory, temp disk,
etc, and that queries with large requirements for some or all of those can
be allocated as much as possible, and those with smaller requirements will
be run (likely at much higher rates) while longer running queries take up
the larger resource pool.

(2) is what this thread is mostly talking about, and the dynamic allocation
of memory to plan nodes (sort, hash) needs to be done so that we are much
more efficient in memory footprint and give more where it's needed. (2)
will require some way of putting an overall memory footprint to a statement,
then sub-allocating within it. I suggest we assume that the overall memory
footprint is constrained somehow, perhaps another GUC that describes a per
statement maximum memory consumption, then at plan time we determine the
sub-allocations that best achieve the plan. This would fit within a scheme
for (1) when we develop one.

- Luke

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2006-03-18 21:39:56 Re: OSX intel
Previous Message Luke Lonergan 2006-03-18 21:21:30 Re: Automatically setting work_mem

Browse pgsql-patches by date

  From Date Subject
Next Message Ashley Clark 2006-03-18 21:35:19 Bonjour registration on Intel Macs is broken
Previous Message Luke Lonergan 2006-03-18 21:21:30 Re: Automatically setting work_mem