Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UNrek-0006ax-TY for pgsql-bugs@arkaria.postgresql.org; Thu, 04 Apr 2013 21:25:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UNrek-0000px-9p for pgsql-bugs@arkaria.postgresql.org; Thu, 04 Apr 2013 21:25:14 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UNrej-0000pj-Mv for pgsql-bugs@postgresql.org; Thu, 04 Apr 2013 21:25:13 +0000 Received: from [2404:130:0:10::40:2] (helo=mail.catalyst.net.nz) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UNrec-0007Xt-RD for pgsql-bugs@postgresql.org; Thu, 04 Apr 2013 21:25:13 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.catalyst.net.nz (Postfix) with ESMTP id CB885332D4 for ; Fri, 5 Apr 2013 10:25:03 +1300 (NZDT) X-Virus-Scanned: Debian amavisd-new at catalyst.net.nz Received: from mail.catalyst.net.nz ([127.0.0.1]) by localhost (bertrand.catalyst.net.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Rp4Lu2lHiJJj for ; Fri, 5 Apr 2013 10:25:02 +1300 (NZDT) Received: from [IPv6:2404:130:0:1000:222:4dff:fe88:a586] (unknown [IPv6:2404:130:0:1000:222:4dff:fe88:a586]) (Authenticated sender: mark.kirkwood) by mail.catalyst.net.nz (Postfix) with ESMTPSA id F33E23324E for ; Fri, 5 Apr 2013 10:25:01 +1300 (NZDT) Message-ID: <515DEFAD.8010708@catalyst.net.nz> Date: Fri, 05 Apr 2013 10:25:01 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: pgsql-bugs@postgresql.org Subject: Re: BUG #8034: pg_buffercache gets invalid memory alloc request size with very large shared memory buffers References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2404:130:0:10::40:2 (failed) X-Pg-Spam-Score: -1.1 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 03/04/13 08:44, dbenhur@whitepages.com wrote: > The following bug has been logged on the website: > > Bug reference: 8034 > Logged by: Devin Ben-Hur > Email address: dbenhur@whitepages.com > PostgreSQL version: 9.2.3 > Operating system: Ubuntu Precise > Description: > > When a very large shared buffer pool (~480GB) is used with postgresql, > pg_buffercache contrib module gets an allocation error trying to Allocate > NBuffers worth of BufferCachePagesRec records: > > https://github.com/postgres/postgres/blob/REL9_2_3/contrib/pg_buffercache/pg_buffercache_pages.c#L101-L102 > > The requested allocation exceeds the 1GB limitation imposed by > AllocSizeIsValid macro: > https://github.com/postgres/postgres/blob/REL9_2_3/src/include/utils/memutils.h#L40-L43 > > Reproduce: > 1) acquire server with half terabyte of memory > 2) tweak OS settings to allow large shared memory > 3) set postgresql.conf: shared_buffers = 400GB > 4) CREATE EXTENSION pg_buffercache; > 5) SELECT * FROM pg_buffercache LIMIT 1; > > > Yes indeed - however I'm not sure this is likely to be encountered in any serious configuration. The general rule for sizing shared buffers is: shared_buffers = min(0.25 * RAM, 8G) Now there has been some discussion about how settings bigger than 8G make sense in some cases...but I'm not aware of any suggestions that sizes in the hundreds of G make sense. However it would be nice if pg_buffercache *could* work with bigger sizes if they make sense at any time. Someone who understands the memory allocation system better than I do will need to comment about how that might work :-) Cheers Mark -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs