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