11

I'm running Postgresql on a Ubuntu server and need to be able to monitor its memory usage. Currently I have scripts running in a one-minute cron job that monitor/log various statistics and need to also monitor/log the current memory usage of Postgresql. I've searched around and haven't been able to find much, other than the fact that Postgresql makes good use of shared memory so the values given by a program such as 'top' aren't accurate.

How can I monitor what the total memory usage of Postgresql is at any given time? This data will later be used to create graphs for analysis.

asked Feb 8, 2012 at 18:11

2 Answers 2

8

Memory usage in linux in general and for Postgres in particular is a pretty complex subject, a good starting point is Bruce Momjians blog covering the subject and the usage of smem. It is well worth following the links in Chris Seibenmanns blog on the subject.

answered Feb 8, 2012 at 20:44
1
  • Thanks for the links, but it appears that smem won't work either as the kernel version is too old. Good articles though. Commented Feb 8, 2012 at 22:29
0

You can use pmap command to get the used memory of a process:

# pmap -p PID
answered Feb 8, 2012 at 19:25
1
  • Unfortunately pmap isn't very useful in this case as Postgresql uses a lot of shared memory. At times the total memory reported by tools like pmap for Postgresql is greater than the total usable memory on the system because of this. Commented Feb 8, 2012 at 20:06

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.