Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 6FD1C1337B4E for ; Sun, 7 Nov 2010 19:30:25 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 82722-05 for ; Sun, 7 Nov 2010 23:30:18 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by mail.postgresql.org (Postfix) with ESMTP id 15D6C1337B71 for ; Sun, 7 Nov 2010 19:30:17 -0400 (AST) Received: from [192.168.1.7] (static-71-179-240-8.bltmmd.fios.verizon.net [71.179.240.8]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0LviEG-1OU67w2alQ-017W9A; Mon, 08 Nov 2010 00:30:17 +0100 Message-ID: <4CD73686.4090807@2ndquadrant.com> Date: Sun, 07 Nov 2010 18:30:14 -0500 From: Greg Smith User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: Mark Rostron CC: "pgsql-performance@postgresql.org" Subject: Re: questions regarding shared_buffers behavior References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:Jih9p9Ai3Ycg/ax75jIsTCuhAVOdbLIeIGJqd21/1zG /RN8Je4tSxUD4w0sEBwbpABewcJRZE51x507vaEzqcEz1PdBHY X+pTXKQN5yQ0KTb9/5FT8YLu7AKfI+8bqIiL0OuXyudsHaknTh VreeNb1wvxCdbPZm1RgOn3UdXvn78Tcb0uVakbOeTBtcOENV8e MwBTCKqNYM+Zk3TIAWZW74fAPsCg4aXouqY2AePr6Y= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201011/87 X-Sequence-Number: 41111 Mark Rostron wrote: > > What is the procedure that postgres uses to decide whether or not a > table/index block will be left in the shared_buffers cache at the end > of the operation? > There is no such procedure. When a table or index page is used, its usage count goes up, which means it's more likely to stay in the cache for longer afterwards. Processing trying to allocate pages are constantly circling the buffer cache looking for pages where the usage count is at 0 to re-use. The only special cases are for sequential scans and VACUUM, which use continuously re-use a small section of the buffer cache in some cases instead. -- Greg Smith 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD PostgreSQL Training, Services and Support www.2ndQuadrant.us "PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books