Shared memory usage calculations

From: Thom Brown <thombrown(at)gmail(dot)com>
To: pgsql-docs(at)postgresql(dot)org
Subject: Shared memory usage calculations
Date: 2009-10-10 12:52:04
Message-ID: bddc86150910100552n278874f3q7cd8432ec9aa850c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

I've had a look at the documentation for how much shared memory (in bytes)
Postgres uses:
http://www.postgresql.org/docs/8.4/static/kernel-resources.html#SHARED-MEMORY-PARAMETERS
However, after using these calculations to work out the shared memory usage
for my own setup, the numbers I came up with are clearly wrong. Here's what
I put my values down as:

max_locks_per_transaction = 64
max_connections = 220
autovacuum_max_workers = 3
max_prepared_transactions = 0
block_size = 8192
shared_buffers = 196000000 (196MB)
wal_block_size = 8192
wal_buffers = 8000000 (8MB)

Using the calculations on that page, it puts my shared memory requirements
up to 1.7 terabytes, but my server is running along fine with these
settings.

If I convert the sizes to kilobytes instead of bytes, it shows a total value
of 47 megabytes, which, while not extreme, looks too low. And I am
surprised that max_connections has relatively little bearing on the shared
memory requirements. Is this right, or should is it more a case of it
affecting semaphores? I was under the impression that the maximum number of
connections played a large role in deciding shared memory limits.

My SHMMAX is currently set at 268435456, which I thought was just enough to
cover my config settings.

Is the documentation flawed, or am I using the wrong units?

Thanks

Thom

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2009-10-10 13:57:33 Re: Shared memory usage calculations
Previous Message Pavel Golub 2009-09-29 09:01:57 pg_restore listing