Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TYTVM-0006iD-5U for pgsql-admin@postgresql.org; Wed, 14 Nov 2012 03:19:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TYTVK-0007oh-Sv for pgsql-admin@postgresql.org; Wed, 14 Nov 2012 03:19:07 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id qAE3J3na006893; Tue, 13 Nov 2012 22:19:03 -0500 (EST) From: Tom Lane To: Craig Ringer cc: Aaron Bono , Postgres Subject: Re: Postgre Eating Up Too Much RAM In-reply-to: <50A309DA.2040702@2ndQuadrant.com> References: <50A309DA.2040702@2ndQuadrant.com> Comments: In-reply-to Craig Ringer message dated "Wed, 14 Nov 2012 11:02:50 +0800" Date: Tue, 13 Nov 2012 22:19:03 -0500 Message-ID: <6892.1352863143@sss.pgh.pa.us> X-Pg-Spam-Score: -2.1 (--) X-Archive-Number: 201211/69 X-Sequence-Number: 40314 Craig Ringer writes: > On 11/14/2012 06:12 AM, Aaron Bono wrote: >> Am I reading this right? Are there individual connections using over >> 300 MB or RAM by themselves? > If I recall correctly, RSS is charged against a PostgreSQL back-end when > it touches `shared_buffers`. So that doesn't necessarily mean that the > back-end is using the full amount of memory listed as RSS. Yeah. Since Aaron's got shared_buffers set to 256MB, the shared memory segment is something more than that (maybe 270-280MB, hard to be sure without checking). The RSS numbers probably count all or nearly all of that for each process, but of course there's really only one copy of the shared memory segment. RSS is likely double-counting the postgres executable as well, which means that the actual additional memory used per process is probably just a few meg, which is in line with most folks' experience with PG. The "free" stats didn't look like a machine under any sort of memory pressure --- there's zero swap usage, and nearly half of real RAM is being used for disk cache, which means the kernel can find no better use for it than caching copies of disk files. Plus there's still 10G that's totally free. Maybe things get worse when the machine's been up longer, but this sure isn't evidence of trouble. I'm inclined to think that the problem is not RAM consumption at all but something else. What exactly happens when the server "hangs"? regards, tom lane