Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id E2D45632A03 for ; Wed, 4 Mar 2009 02:51:10 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 81700-05 for ; Wed, 4 Mar 2009 02:51:02 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gx0-f176.google.com (mail-gx0-f176.google.com [209.85.217.176]) by mail.postgresql.org (Postfix) with ESMTP id 255976337A8 for ; Wed, 4 Mar 2009 02:51:02 -0400 (AST) Received: by gxk24 with SMTP id 24so7356523gxk.19 for ; Tue, 03 Mar 2009 22:51:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=zKrVsokM+eJtKlm551YgJfRCqc4LRoq1oCFkt49QBys=; b=FUhMzAB09FfZA8Lqq9Ps+2F+trxhyKTkXTtZ56XAhXCy1ME9IHycATzlO2ISMI2oq2 lOA/vcdxp8g07vFn5tP6OdsXz/HF/W9gJi+oItKyz45E5p5cpgMsRWKhFbvMXNPG7o7+ ciPBn6lH9NR/oLKmf3/6wnHO6DiFCW9jL2Dy8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Gk5nFWyqpIhLIojfGL6hgE5nXknY5gexVzcAAqGl7xg+AlwZJZD6yc0jh2bZBsSu3d TjefdDX70/yURI2K4m9tIphz5Prh2Ia285GZknbTMOOQkCoOOFs2GlRBIV54iFbvrJIC Dmi6EDhC36fg5yH8/FV20VS3Dwrr0xiVvAkbg= MIME-Version: 1.0 Received: by 10.151.150.13 with SMTP id c13mr14087433ybo.63.1236149461421; Tue, 03 Mar 2009 22:51:01 -0800 (PST) In-Reply-To: <482E80323A35A54498B8B70FF2B8798003ED1B9CF0@azsmsx504.amr.corp.intel.com> References: <49ABDB1F.2020208@elitecore.com> <482E80323A35A54498B8B70FF2B8798003ED1B9CF0@azsmsx504.amr.corp.intel.com> Date: Tue, 3 Mar 2009 23:51:01 -0700 Message-ID: Subject: Re: Shared Buffers From: Scott Marlowe To: "Gauthier, Dave" Cc: Siddharth Shah , "pgsql-general@postgresql.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200903/91 X-Sequence-Number: 144677 On Mon, Mar 2, 2009 at 7:40 AM, Gauthier, Dave wr= ote: > I believe that op system side buffering can play a role too.=A0 I our cas= e, > the DB server (machine & op sys) caches data that it pulled from disk (no= t > necessarily from a DB) and also the disk servers do the same.=A0 If a blo= ck > was removed from the DB buffer cache to accommodate more recently request= ed > data, but the evicted block is live in memory on the DB server or the dis= k > server, it can pull from there instead of performing an expensive disk-IO= . This is very true for certain workloads. If your db is bigger than memory, and you only work on a tiny bit at a time, the kernel is often better at caching than pgsql. Run something like pgbench on a machine with say 4 Gig of memory and a 40 Gig pgbench db dir, and you're better off with 128M or something for shared_buffers than 1G often times. Truly random small access, has, for me, worked better with moderate to smaller shared_buffers. Plus if you need to run a few memory hog queries, the kernel can flush out some free memory from cache quickly, but shared_buffers is static. So, the kernel file cache is self tuning. But you'll have to test it with your application to really see.