Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YBtlt-00039t-VO for pgsql-performance@arkaria.postgresql.org; Thu, 15 Jan 2015 23:24:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YBtlt-0003jA-FN for pgsql-performance@arkaria.postgresql.org; Thu, 15 Jan 2015 23:24:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YBtls-0003j3-DI for pgsql-performance@postgresql.org; Thu, 15 Jan 2015 23:24:12 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YBtlp-0006gj-0N for pgsql-performance@postgresql.org; Thu, 15 Jan 2015 23:24:11 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t0FNO5kw030354; Thu, 15 Jan 2015 18:24:05 -0500 From: Tom Lane To: Jeff Janes cc: Huan Ruan , "pgsql-performance@postgresql.org" Subject: Re: shared_buffers vs Linux file cache In-reply-to: References: Comments: In-reply-to Jeff Janes message dated "Thu, 15 Jan 2015 14:22:17 -0800" Date: Thu, 15 Jan 2015 18:24:05 -0500 Message-ID: <30353.1421364245@sss.pgh.pa.us> 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 Jeff Janes writes: > On Thu, Jan 15, 2015 at 3:30 AM, Huan Ruan wrote: >> I thought 'shared_buffers' sets how much memory that is dedicated to >> PostgreSQL to use for caching data, therefore not available to other >> applications. > While PostgreSQL has reserves the right to use 32GB, as long as PostgreSQL > has not actually dirtied that RAM yet, then the kernel is free to keep > using it to cache files. Another thing to keep in mind is that, even if Postgres *has* used the RAM, the kernel might decide to swap parts of it out if it's not being used heavily. This is pretty disastrous from a performance standpoint, so it's advisable to not make shared_buffers very much larger than what your application will keep "hot". Ideally we'd lock the shared buffer arena into RAM to prevent that, but such facilities are often unavailable or restricted to root. regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance