Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id A85D19FB5B7 for ; Tue, 12 Jun 2007 14:47:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 99896-03-2 for ; Tue, 12 Jun 2007 14:47:40 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.238]) by postgresql.org (Postfix) with ESMTP id 209949FBA9C for ; Tue, 12 Jun 2007 14:47:40 -0300 (ADT) Received: by wr-out-0506.google.com with SMTP id 68so1357443wri for ; Tue, 12 Jun 2007 10:47:39 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:subject:from:reply-to:to:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; b=ljXmrqMz08eCaGaW0y28QJLgVdQdaPHbTKYiqiAEpMTWuwI5L0IMibOIqGAfBA7onRaUOZSG+NDhQafRg7/x4x8C7s/tPTfPcm75WzIfXUMLBVf6vluy50KFRqjheGDoVVUpfgE8+vDxYswb/mJXM2+gyeTWjHbyYQt53T1ak+g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:subject:from:reply-to:to:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; b=GIWnmb4PZ3EOGyd7d1DmAPkBTxFnSGD7RcB8hsF6KwSLXshQCMh23zPlECTJOLwJY5zH6bkjYCCB/A2QQIjN2IrrKKsJV/2TtfWH2nlb+2MmZuAs2cXUjvyDuUog+K76Ls6KFa775x+GiWIp3fg+ycGvxYore7mGymC6jNDd2lQ= Received: by 10.90.97.11 with SMTP id u11mr6886021agb.1181670459218; Tue, 12 Jun 2007 10:47:39 -0700 (PDT) Received: from ?192.168.1.83? ( [206.114.45.106]) by mx.google.com with ESMTP id 16sm8537895nzo.2007.06.12.10.47.38 (version=SSLv3 cipher=RC4-MD5); Tue, 12 Jun 2007 10:47:38 -0700 (PDT) Subject: Re: A question about memory usage From: Adam Tauno Williams Reply-To: adamtaunowilliams@gmail.com To: "pgsql-admin@postgresql.org" In-Reply-To: <466ED760.6060202@andromeiberica.com> References: <466ED760.6060202@andromeiberica.com> Content-Type: text/plain Date: Tue, 12 Jun 2007 13:46:07 -0400 Message-Id: <1181670367.5493.16.camel@aleph.whitemice.org> Mime-Version: 1.0 X-Mailer: Evolution 2.8.2 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/105 X-Sequence-Number: 25773 > I have a server with 4GB of RAM and I wanted to know how much memory > is being used by a PostgreSQL. To do so I have executed the following: > ps -A -o rss,vsz,command|grep postgres | awk '{rss += $1; vsz += $2 } > END { print "Real: ",rss/1024"MB Virtual: ",vsz/1024"MB" }' > And the result is: > Real: 157.59MB Virtual: 6359.04MB > So I understand that amount of virtual memory must be swapped to disk as > it's bigger that my physical memory. To check this I have executed the > free command and I get the following results: > total used free shared buffers cached > Mem: 4153180 3988536 164644 0 161400 3117900 > -/+ buffers/cache: 709236 3443944 > Swap: 6215672 64 6215608 > So my question is, what I'm doing wrong? because the swap it's almost > empty You are misunderstanding what these numbers mean on a UNIX system. For starters - http://virtualthreads.blogspot.com/2006/02/understanding-memory-usage-on-linux.html And if you are not swapping, and your OS's cache is that huge, why bother? Use "ipcs" to display the allocation of shared memory. -- Adam Tauno Williams, Network & Systems Administrator Consultant - http://www.whitemiceconsulting.com Developer - http://www.opengroupware.org