X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0DE0FD1B232; Fri, 11 Jun 2004 05:02:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77240-04; Fri, 11 Jun 2004 08:02:43 +0000 (GMT) Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net [194.217.242.92]) by svr1.postgresql.org (Postfix) with ESMTP id DBD90D1B16B; Fri, 11 Jun 2004 05:02:39 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-34.mail.demon.net with esmtp (Exim 3.35 #1) id 1BYgzo-0006hE-0Y; Fri, 11 Jun 2004 09:02:40 +0100 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 7BFD016442; Fri, 11 Jun 2004 09:02:36 +0100 (BST) Message-ID: <40C9671C.6020202@archonet.com> Date: Fri, 11 Jun 2004 09:02:36 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 0.6 (X11/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mark Striebeck Cc: pgsql-admin@postgresql.org, pgsql-general@postgresql.org Subject: Re: [GENERAL] out of memory error References: <40C90778.4090308@vasoftware.com> In-Reply-To: <40C90778.4090308@vasoftware.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/145 X-Sequence-Number: 13805 Mark Striebeck wrote: > Hi, > > we are using Postgres with a J2EE application (JBoss) and get > intermittent "out of memory" errors on the Postgres database. We are > running on a fairly large Linux server (Dual 3GHz, 2GB Ram) with the > following parameters: > > shared_buffers = 8192 > sort_mem = 8192 > effective_cache_size = 234881024 > random_page_cost = 2 The effective_cache_size is measured in disk-blocks not bytes, so you'll want to reduce that. It should be whatever the typical "cached" readout of top is, divided by 8k. > (everything else is default) > > The error message in the log is: > > Jun 10 17:20:04 cruisecontrol-rhea postgres[6856]: [6-1] ERROR: 53200: > out of memory > Jun 10 17:20:04 cruisecontrol-rhea postgres[6856]: [6-2] DETAIL: Failed > on request of size 208. > Jun 10 17:20:04 cruisecontrol-rhea postgres[6856]: [6-3] LOCATION: > AllocSetAlloc, aset.c:700 What is the system's overall memory usage at this time? Is there one postgresql backend using all this memory? > All failures are with the following query (again, it only fails every > now and then). The query returns only a few results: [snip] > Can anyone see anything dangerous about this query? The only thing that struck me was you had 11 tables in the join which means the geqo query-planner will kick in (assuming default config values). If you can reproduce it regularly, you could try increasing geqo_threshold and see if that had any effect. > What's the best way to analyze this further? 1. Monitor memory usage when you run the query, see which process is using what. 2. Get EXPLAIN ANALYSE for that query, there may be something unusual in the plan. 3. Finally, might have to attach a debugger to a backend, but we'll need to know what to look for first. -- Richard Huxton Archonet Ltd