0

I'm running Postgres 8.1 on a CentOS 5 system with 4 GB of RAM. Whenever I set shared_buffers above 320 MB, it won't run.

I've checked SHMMAX and it's at 4294967295 which is the max allowed for a 32-bit/4 GB system. Below are some of the other memory related settings:

max_connections = 225
shared_buffers = 327680
work_mem = 524288
max_fsm_pages = 500000
max_fsm_relations = 10000

Any suggestions on what could improve this?

  • 1
    Postgres 8.1 on a CentOS 5 system. There's your problem ;) . More seriously, check if anything else is locking a lot of shmem on the system. – Craig Ringer Jul 22 '15 at 7:07
  • Yeah, @CraigRinger is right - that system is so old it already has grandchildren... Other than that, do you get an error message of some sort? – dezso Jul 22 '15 at 8:33
  • @dezso - I usually run /etc/init.d/postgresql restart and it just says "Failed" on the start. I've tried tweaking SHMAX but it doesn't do any good. (SHMAX is already set pretty high). I've reduced the number of max_connections down to 200, but still no dice. – Tensigh Jul 22 '15 at 9:04
1

Just a misunderstanding I guess. The unit for the given number is blocks (or buffers), not 1 kb like you assume.
Quoting the manual for shared_buffers:

Each buffer is 8192 bytes, unless a different value of BLCKSZ was chosen when building the server.

Bold emphasis mine.

SELECT pg_size_pretty(327680 *  8192::numeric);

pg_size_pretty
--------------
2560 MB

Not 320 MB. In modern Postgres the syntax with appended unit is preferred: 320MB, but I don't think that's implemented in the ancient Postgres 8.1, yet. For 320 MB set the GUC to:

shared_buffers = 40960

Have you considered installing a modern version of Postgres? (Like has been hinted in the comments ever so gently). Postgres 8.1 was released 10 years ago.

  • Hey Erwin, Thanks for the clarification. When I'm at work tomorrow I will try that. Yes, I would like to upgrade Postgres on this server. Since it's a production server, I had to do it on the staging server first, which I finally did (a real ordeal since 8.1 doesn't work with pg_upgrade). – Tensigh Jul 22 '15 at 13:22
  • Thank you, Erwin. That fixed it. I still get really high CPU usage on queries but I guess that's a different thread. – Tensigh Jul 23 '15 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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