Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 8BE03650304 for ; Thu, 28 Aug 2008 14:56:20 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 02204-01-2 for ; Thu, 28 Aug 2008 14:56:03 -0300 (ADT) X-Greylist: delayed 00:05:25.198761 by SQLgrey-1.7.6 Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.230]) by postgresql.org (Postfix) with ESMTP id 6A4D36502AD for ; Thu, 28 Aug 2008 14:55:28 -0300 (ADT) Received: by wr-out-0506.google.com with SMTP id c49so421619wra.19 for ; Thu, 28 Aug 2008 10:55:27 -0700 (PDT) Received: by 10.90.69.7 with SMTP id r7mr1997069aga.16.1219945801991; Thu, 28 Aug 2008 10:50:01 -0700 (PDT) Received: from ?192.168.1.10? ( [24.7.36.154]) by mx.google.com with ESMTPS id k8sm2131942qba.5.2008.08.28.10.50.00 (version=SSLv3 cipher=RC4-MD5); Thu, 28 Aug 2008 10:50:01 -0700 (PDT) Subject: Re: select on 22 GB table causes "An I/O error occured while sending to the backend." exception From: Jeff Davis To: Tom Lane Cc: david@lang.hm, Andrew Sullivan , pgsql-performance@postgresql.org In-Reply-To: <659.1219899383@sss.pgh.pa.us> References: <82bpze3ou8.fsf@mid.bfk.de> <20080827221338.GP18946@commandprompt.com> <659.1219899383@sss.pgh.pa.us> Content-Type: text/plain Date: Thu, 28 Aug 2008 10:51:16 -0700 Message-Id: <1219945876.22237.15.camel@jdavis> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200808/378 X-Sequence-Number: 31259 On Thu, 2008-08-28 at 00:56 -0400, Tom Lane wrote: > Actually, the problem with Linux' OOM killer is that it > *disproportionately targets the PG postmaster*, on the basis not of > memory that the postmaster is using but of memory its child processes > are using. This was discussed in the PG archives a few months ago; > I'm too lazy to search for the link right now, but the details and links > to confirming kernel documentation are in our archives. > http://archives.postgresql.org/pgsql-hackers/2008-02/msg00101.php It's not so much that the OOM Killer targets the parent process for a fraction of the memory consumed by the child. It may not be a great design, but it's not what's causing the problem for the postmaster. The problem for the postmaster is that the OOM killer counts the children's total vmsize -- including *shared* memory -- against the parent, which is such a bad idea I don't know where to start. If you have shared_buffers set to 1GB and 25 connections, the postmaster will be penalized as though it was using 13.5 GB of memory, even though all the processes together are only using about 1GB! Not only that, killing a process doesn't free shared memory, so it's just flat out broken. Regards, Jeff Davis