Re: Controlling memory of session

From: Richard Huxton <dev(at)archonet(dot)com>
To: James Im <im-james(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Controlling memory of session
Date: 2007-01-17 12:20:24
Message-ID: 45AE1488.4020600@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

James Im wrote:
> Hi,
>
> I'm using Postgresql 8.1 on windows2000 and I have a hard time
> understanding how to limit the memory of the sessions to 1 MB.

Well, you don't explicitly, but see below.

> What I have right now is that each connection (opened with jdbc) takes
> about 3MB (some take a little more, some a little less). I think that
> this is a waste of memory (am-I wrong?).

Depends what you mean by "waste". If you never use those connections,
then yes. Otherwise, each connection does need a little space to work in
you know.

> I've read the doc
> (http://www.postgresql.org/docs/8.1/static/runtime-config-resource.html)
> for work_mem and temp_buffers and they have this value:
>
> work_mem = 1024
> temp_buffers = 100
>
> What am I missing to limit the memory taken by session to 1MB?

You can't. In particular, work_mem is memory *per sort* so can be
several times that. If you're trying to get PG to run in 64MB or
something like that, I think you're going to be disappointed. In
particular, large result sets will tend to need more than 1MB at either
the server or client end of the connection.

Is there a particular problem you're trying to solve?

> In addition I'd like to understand better temp_buffers. I never create
> temporary tables but I wonder if postgresql does it behind the scene
> when I do some big selects.

Various operations will spill to disk in a similar manner to a temporary
table, but they're not tables per-se.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2007-01-17 12:23:06 Re: copy row tree
Previous Message James Im 2007-01-17 11:02:00 Controlling memory of session