Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have read several articles (including Postgres docs) that suggest setting the shared_buffer's config value to 25% of your total physical memory.

Using my 4 GB memory as an example... If I understand correctly, when postgres starts up, it will request ~1 GB of physical memory from the OS. It will use this for buffering purposes. Thus, when I look at a utility like "top" I see the size/RES of the postgres process to be ~1GB.

So my question is - what happens when I have POOLED connections to Postgres? i.e. A Tomcat server which keeps N number of open, idle connections to postgres? I can see there are N number of postgress processes waiting in the background for requests from Tomcat. Each process is the same size (~1Gb). They're forks of the original process, I suppose. So does that mean Postgres as a whole is taking up N*1GB of memory?? Isn't this a bad thing to make shared_buffer this large??

share|improve this question
up vote 3 down vote accepted

No, it's still only 1GB of total memory.

The buffer is allocated as shared memory and it only allocated once, but shared between all server processes.

It's basically an "error" in the memory display of the top command, which simply reports the shared memory (that only exists once) for each process.

share|improve this answer
Your last paragraph is exactly what I was thinking! - Thanks for the confirmation! – Jmoney38 Mar 1 '12 at 12:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.