Re: Shared memory usage calculations

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thom Brown <thombrown(at)gmail(dot)com>
Cc: pgsql-docs(at)postgresql(dot)org
Subject: Re: Shared memory usage calculations
Date: 2009-10-10 13:57:33
Message-ID: 20735.1255183053@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Thom Brown <thombrown(at)gmail(dot)com> writes:
> 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.

Clearly wrong compared to what --- ie, what's the actual size of your
shared memory segment? (See ipcs)

> 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.

No, it doesn't really ... shared_buffers is the first-order component.
Also, I'm not sure whether you realize that the native unit for these
numbers is mostly *not* bytes.

> shared_buffers = 196000000 (196MB)
> wal_buffers = 8000000 (8MB)

Neither of those parenthetical remarks are correct if that's exactly
what you wrote in postgresql.conf. It might be worth checking the
way these values are displayed in pg_settings.

regards, tom lane

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Thom Brown 2009-10-10 14:29:31 Re: Shared memory usage calculations
Previous Message Thom Brown 2009-10-10 12:52:04 Shared memory usage calculations