From: Tom Lane <tgl@sss.pgh.pa.us>
To: arnaulist@andromeiberica.com
Cc: " <pgsql-admin@postgresql.org>
Subject: Re: A question about memory usage
Date: Wed, 13 Jun 2007 10:08:29 -0400
Message-ID: <9524.1181743709@sss.pgh.pa.us> (raw)
In-Reply-To: <466ECFF1.1010302@androme.es>
References: <466ECFF1.1010302@androme.es>
Arnau Rebassa i Villalonga <arnau.rebassa@androme.es> writes:
> I have a server with 4GB of RAM and I wanted to know how much memory
> is being used by a PostgreSQL. To do so I have executed the following:
> ps -A -o rss,vsz,command|grep postgres | awk '{rss += $1; vsz += $2 }
> END { print "Real: ",rss/1024"MB Virtual: ",vsz/1024"MB" }'
Depending on the details of your ps command, this is likely counting
Postgres' shared memory area over again for each backend. It's
definitely counting the executable-program image over again for each
backend, even though on any modern system those pages will be shared.
So it's no surprise that you get a number a lot larger than the actual
RAM footprint.
I don't know of any good portable way to get the number you want :-(.
If your ps can distinguish shared and unshared pages, adding up all the
unshared pages and counting one instance of the shared pages will be
reasonably close.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, arnaulist@andromeiberica.com
Subject: Re: A question about memory usage
In-Reply-To: <9524.1181743709@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox