X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id CB17C9FB4DB for ; Fri, 1 Sep 2006 16:35:20 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 23205-02 for ; Fri, 1 Sep 2006 16:34:34 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mnc.ch (62-2-77-205.static.cablecom.ch [62.2.77.205]) by postgresql.org (Postfix) with ESMTP id CFA6D9FB9FC for ; Fri, 1 Sep 2006 14:01:16 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.mnc.ch (Postfix) with ESMTP id 8567AA82E2 for ; Fri, 1 Sep 2006 19:06:39 +0200 (CEST) Received: from mail.mnc.ch ([127.0.0.1]) by localhost (mail.test.lan [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 22919-07 for ; Fri, 1 Sep 2006 19:06:39 +0200 (CEST) Received: from meuh.mnc.lan (62-2-77-204.static.cablecom.ch [62.2.77.204]) by mail.mnc.ch (Postfix) with ESMTP id 25890A82A5 for ; Fri, 1 Sep 2006 19:06:39 +0200 (CEST) Received: by meuh.mnc.lan (Postfix, from userid 1000) id 061E918372E; Fri, 1 Sep 2006 19:00:53 +0200 (CEST) To: pgsql-performance@postgresql.org Subject: increasing shared buffers: how much should be removed from OS filesystem cache? X-Hashcash: 1:20:060901:pgsql-performance@postgresql.org::3DPL6O20aGQO+PAA:00000000000000000000000000000CR+D From: Guillaume Cottenceau Date: 01 Sep 2006 19:00:52 +0200 Message-ID: <87veo7a5dn.fsf@meuh.mnc.lan> Lines: 35 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: amavisd-new at mnc.ch X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.199 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200609/5 X-Sequence-Number: 20691 Hi, I've been looking at the results from the pg_statio* tables, to view the impact of increasing the shared buffers to increase performance. As expected, increasing from the default by a factor of 10~20 moves table/index disk blocks reads to cache hits, but the overall service time of my test page is not changed (I'm testing with a set of queries implying an increase of 170,000 of sum(heap_blks_hit) and 2,000 of sum(idx_blks_hit) from pg_statio_user_tables). I've seen that documentation says: data that is not in the PostgreSQL buffer cache may still reside in the kernel's I/O cache, and may therefore still be fetched without requiring a physical read I guess this is the best explanation (btw, my test machine runs Linux 2.6 on 1G of RAM), but I'm still wondering what should be expected from moving caching from OS filesystem to PG - probably PG can "cleverly" flush its cache when it is full (e.g. table data before index data maybe?), whereas the OS will do it "blindly", but I'm wondering about the limits of this behaviour, particularly considering that being "very clever" about cache flush would probably need realtime query statistics which I am not sure PG does. After all, memory added to shared buffers should be mecanically removed from effective cache size (or others), so I cannot just increase it until the OS cannot cache anymore :) -- Guillaume Cottenceau