Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 694D09FB666 for ; Sat, 12 May 2007 08:41:52 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 10865-02 for ; Sat, 12 May 2007 08:41:44 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 1C1AB9FB6DD for ; Sat, 12 May 2007 08:41:47 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from www.loot.co.za (loot.co.za [41.204.193.132]) by svr4.postgresql.org (Postfix) with SMTP id EE29A5AF8A2 for ; Sat, 12 May 2007 11:11:22 +0000 (GMT) Received: (qmail 3644 invoked from network); 12 May 2007 11:10:19 -0000 Received: from unknown (HELO sun.loot.co.za) (10.1.0.2) by 0 with SMTP; 12 May 2007 11:10:19 -0000 Received: (qmail 23221 invoked by uid 7791); 12 May 2007 11:10:12 -0000 Received: from unknown (HELO saturn) (192.168.0.2) by 0 with SMTP; 12 May 2007 11:10:12 -0000 Message-ID: <00b301c79486$1c54da80$0200a8c0@saturn> From: "Michael van Rooyen" To: Subject: Kernel cache vs shared_buffers Date: Sat, 12 May 2007 13:10:12 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200705/238 X-Sequence-Number: 24628 We're in the process of upgrading our db server's memory from 2GB to 8GB to improve access performance. This is a dedicated dual Xeon db server not running any significant non-db processes. Our database size on disk is ~11GB, although we expect it to grow to ~20GB. Much of this data is inactive and seldom used or accessed. Read access is our primary concern as our data is normalized and retrieveing a complete product requires many reads to associated tables and indexes to put it all together. Our larger tables have 10-20 rows per disk block, I assume that most blocks will have a mix of frequently accessed and inactive rows. Of course, we wouldn't want to double-cache, so my inclination would be to either give most of the memory to shared_buffers, or to leave that small and let the kernel (Linux 2.6x) do the buffering. I have no idea regarding the inner working of the pg's shared cache, but what I would like to find out is whether it is table-row-based, or disk-block-based. In the case of it being disk-block based, my inclination would be to let the kernel do the buffering. In the case of the cache being table-row-based, I would expect it to be much more space-efficient and I would be inclined to give the memory to the pg. In that case, is it feasible to set shared_buffers to something like 500000 x 8k blocks? We make extensive use of indexes on the larger tables and would seldom, if ever, do sequential scans. Any comments or advice would be great! Michael.