Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 63CA61337B9C for ; Mon, 7 Feb 2011 15:06:12 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 11059-02 for ; Mon, 7 Feb 2011 19:06:04 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.10]) by mail.postgresql.org (Postfix) with ESMTP id 69E501337B8A for ; Mon, 7 Feb 2011 15:06:04 -0400 (AST) Received: from [192.168.1.6] (mail.highperformancepostgresql.com [71.179.240.8]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0MbaU9-1PWEZR0MKL-00J5PM; Mon, 07 Feb 2011 20:05:28 +0100 Message-ID: <4D504275.5040103@2ndquadrant.com> Date: Mon, 07 Feb 2011 14:05:25 -0500 From: Greg Smith User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: Craig Ringer CC: felix , "pgsql-performance@postgresql.org" Subject: Re: Really really slow select count(*) References: <4D4C138C.7010304@2ndquadrant.com> <4D4C1555.40209@peak6.com> <4D4C2AC3.5020804@peak6.com> <4D4F6109.1090209@postnewspapers.com.au> In-Reply-To: <4D4F6109.1090209@postnewspapers.com.au> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:H2AnSudO8KsDuDflZX/o9HF26PyyzbHJ65QFuisDrJd a5J5IZveTYsO9iX5NuTsL3AI4jSZH0aLMOrUejkuPLXeYhiI08 EvSosc458QpA3ckMVrIyD+K+9ExMiN8HTZKy8aIpFj/BUUOmBO L1Fun05f1hkk2MMOAOMnjrA+YRg6dEMsuW7DruITqFRT9mLrjh Vxg5HFC8t9XHYmpb8YPKeS/SMr2Pk70aZSZIvOV/zg= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201102/288 X-Sequence-Number: 42426 Craig Ringer wrote: > What would possibly help would be if Pg could fall back to lower > shared_buffers automatically, screaming about it in the logs but still > launching. This is exactly what initdb does when it produces an initial setting for shared_buffers that goes into the postgresql.conf file. It wouldn't be hard to move that same logic into a loop that executed when startup failed to allocated enough memory. There are two problems here, one almost solved, the other more philosphical. It used to be that max_fsm_pages and wal_buffers could be large enough components to the allocation that reducing them might actually be a necessary fix, too. With the removal of the former and a method to automatically set the latter now available, the remaining components to the shared memory sizing computation are probably possible to try and fix automatically if the kernel limits are too low. But it's unclear whether running in a degraded mode, where performance might be terrible, with only a log message is preferrable to stopping and forcing the DBA's attention toward the mistake that was made immediately. Log files get rotated out, and it's not hard to imagine this problem coming to haunt someone only a month or two later--by which time the change to shared_buffers is long forgotten, and the log message complaining about it lost too. Accordingly I would expect any serious attempt to add some auto-reduction behavior to be beset with argument, and I'd never consider writing such a thing as a result. Too many non-controversial things I could work on instead. -- Greg Smith 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us "PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books