Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xp3vA-0006pj-36 for pgsql-performance@arkaria.postgresql.org; Thu, 13 Nov 2014 23:35:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Xp3v9-0001Dh-K8 for pgsql-performance@arkaria.postgresql.org; Thu, 13 Nov 2014 23:35:23 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Xp3v8-0001Db-P2 for pgsql-performance@postgresql.org; Thu, 13 Nov 2014 23:35:22 +0000 Received: from smtp-out2.gransy.com ([77.78.126.49]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xp3v0-0003NT-O2 for pgsql-performance@postgresql.org; Thu, 13 Nov 2014 23:35:21 +0000 Received: from smtp-out.gransy.com (localhost [127.0.0.1]) by smtp-out2.gransy.com (Postfix) with ESMTP id 2EFFB3F0197 for ; Fri, 14 Nov 2014 00:35:12 +0100 (CET) Received: from smtp.gransy.com (smtp.simplia.cz [77.78.126.20]) by smtp-out2.gransy.com (Postfix) with ESMTP id B8FDB3F0194 for ; Fri, 14 Nov 2014 00:35:11 +0100 (CET) Received: from [192.168.1.163] (ip-78-45-139-138.net.upcbroadband.cz [78.45.139.138]) (Authenticated sender: tv@fuzzy.cz) by smtp.gransy.com (Postfix) with ESMTPSA id 481A619A043D for ; Fri, 14 Nov 2014 00:35:11 +0100 (CET) Message-ID: <5465402F.9030509@fuzzy.cz> Date: Fri, 14 Nov 2014 00:35:11 +0100 From: Tomas Vondra User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Increased shared_buffer setting = lower hit ratio ? References: <54653A1E.3050805@consistentstate.com> <54653BBB.5060508@consistentstate.com> In-Reply-To: <54653BBB.5060508@consistentstate.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Hi, On 14.11.2014 00:16, CS DBA wrote: > This is on a CentOS 6.5 box running PostgreSQL 9.2 > > > On 11/13/14 4:09 PM, CS DBA wrote: >> All; >> >> We have a large db server with 128GB of ram running complex >> functions. >> >> with the server set to have the following we were seeing a >> somewhat low hit ratio and lots of temp buffers >> >> shared_buffers = 18GB >> work_mem = 75MB >> effective_cache_size = 105GB >> checkpoint_segments = 128 >> >> >> when we increased the values to these not only did the hit ratio >> drop but query times are now longer as well: >> >> >> shared_buffers = 28GB >> work_mem = 150MB >> effective_cache_size = 105GB >> checkpoint_segments = 256 >> >> This does not seem to make sense to me, anyone have any thoughts >> on why more memory resources would cause worse performance? what exactly do you mean by hit ratio - is that the page cache hit ratio (filesystem cache), or shared buffers hit ratio (measured e.g. using pg_buffercache)? Regarding the unexpected decrease of performance after increasing shared_buffers - that's actually quite common behavior. First, the management of shared buffers is not free, and the more pieces you need to manage the more expensive it is. Also, by using larger shared buffers you make that memory unusable for page cache etc. There are also other negative consequences - double buffering, accumulating more changes for a checkpoint etc. The common wisdom (which some claim to be obsolete) is not to set shared buffers over ~10GB of RAM. It's however very workload-dependent so your mileage may vary. To get some basic idea of the shared_buffers utilization, it's possible to compute stats using pg_buffercache. Also pg_stat_bgwriter contains useful data. BTW, it's difficult to say why a query is slow - can you post explain analyze of the query with both shared_buffers settings? And just to check - what kind of hardware/kernel version is this? Do you have numa / transparent huge pages or similar trouble-indicing issues? Tomas -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance