Thread: Memory management

Memory management

From
Rémy Dufour
Date:
Hi there,
 
Recently, I've installed postgres 6.5 on a P3 450 396 megs of RAM. I'm
running Linux RedHat 6.2. I got a few db on it and one has around 2 millions records. When I boot my server, I do a 'free' and it tells me that I got around 300 megs of RAM free.
 
After I do a couple of requests like "Select count(ID) from Store" the memory fills itself and my system swaps a bit.
 
So, is there a way to limit the memory postgresql is allowed to use?
 
And, if anyone can point me out some docs or references on how postgresql/linux
 manage its memory.
 
I would just add more memory to my machine, but it seems to me that it will always fills itself and swap some.
 
Regards,
 
Remy Dufour
IT Programmer
WebNet Inc - ISP
remy.tech@webnet.qc.ca

Re: Memory management

From
kumar1@home.com (Prasanth A. Kumar)
Date:
=?iso-8859-1?Q?R=E9my_Dufour?= <remy.tech@webnet.qc.ca> writes:
<snip> Recently, I've installed postgres 6.5 on a P3 450 396 megs of RAM. I'm
> running Linux RedHat 6.2. I got a few db on it and one has around 2 million=
> s records. When I boot my server, I do a 'free' and it tells me that I got =
> around 300 megs of RAM free.
>
> After I do a couple of requests like "Select count(ID) from Store" the memo=
> ry fills itself and my system swaps a bit.
>
> So, is there a way to limit the memory postgresql is allowed to use?
>
> And, if anyone can point me out some docs or references on how postgresql/l=
> inux
>  manage its memory.
>
> I would just add more memory to my machine, but it seems to me that it will=
>  always fills itself and swap some.
<snip>

You might be able to use the ulimit command to prevent a app running
from exceeding a particular amount of virtual memory but that is a
per process limit I think.

Also, a common mistake people make when they check free memory is they
look at the wrong column. In the example below, the free space is
24112K, not 3820K because buffers and caches are just otherwise unused
memory put to good use. See the sample below:

             total       used       free     shared    buffers     cached
Mem:        127720     123900       3820      45420       2984      17308
-/+ buffers/cache:     103608      24112
Swap:       539264      19988     519276

--
Prasanth Kumar
kumar1@home.com