pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Smith <gsmith@gregsmith.com>
To: Max Zorloff <zorloff@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Shared memory usage
Date: Wed, 29 Aug 2007 15:26:06 -0400 (EDT)
Message-ID: <Pine.GSO.4.64.0708291513280.646@westnet.com> (raw)
In-Reply-To: <op.txmwckj4ll0p5y@1-rtt202dnf3uds.mshome.net>
References: <op.txmwckj4ll0p5y@1-rtt202dnf3uds.mshome.net>

First off, posting to two lists like you did (-general and -performance) 
is frowned on here.  Pick whichever is more appropriate for the topic and 
post to just that one; in your case, the performance list would be more 
appropriate, and I'm only replying to there.

On Sun, 26 Aug 2007, Max Zorloff wrote:

> shared_buffers is set to 60000, yet they use a minimal part of that.
> PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
> 11492 postgres  16   0  530m  72m  60m S   14  1.2   0:50.91 postmaster

Looks to me like PostgreSQL is grabbing 530MB worth of memory on your 
system.  run the ipcs command to see how big the block that's dedicated to 
the main server is; I suspect you'll find it's at 400MB just like you 
expect it to be.  Here's an example from my server which has a 256MB 
shared_buffers:

-bash-3.00$ ipcs
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x0052e2c1 1114114    postgres  600        277856256  3

Also:  when you've got top running, hit the "c" key and the postmaster 
processes will give you more information about what they're doing you may 
find helpful.

> All the indexes and half of the database should be in the shared memory, 
> is it not? Or am I completely missing what are the shared_buffers for? 
> If so, then how do I put my indexes and at least a part of the data into 
> memory?

You can find out what's inside the shared_buffers cache by using the 
installing the contrib/pg_buffercache module against your database.  The 
README.pg_buffercache file in there gives instructions on how to install 
it, and the sample query provided there should tell you what you're 
looking for here.

> Where do I find my OS disk cache settings? I'm using Linux.

You can get a summary of how much memory Linux is using to cache data by 
running the free command, and more in-depth information is available if 
you look at the /proc/meminfo information.  I have a paper you may find 
helpful here, it has more detail in it than you need but it provides some 
pointers to resources to help you better understand how memory management 
in Linux works: http://www.westnet.com/~gsmith/content/linux-pdflush.htm

--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD



view thread (8+ messages)  latest in thread

Message-ID: <Pine.GSO.4.64.0708291513280.646@westnet.com>
Permalink:  ../Pine.GSO.4.64.0708291513280.646@westnet.com/
Also on:    postgresql.org/message-id/Pine.GSO.4.64.0708291513280.646@westnet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: gsmith@gregsmith.com, zorloff@gmail.com
  Subject: Re: Shared memory usage
  In-Reply-To: <Pine.GSO.4.64.0708291513280.646@westnet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox