Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VI1TQ-0007pl-7f for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Sep 2013 19:13:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VI1TP-0001mL-Gu for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Sep 2013 19:13:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VI1TO-0001mD-Jx for pgsql-hackers@postgresql.org; Fri, 06 Sep 2013 19:13:38 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VI1TL-0002MS-Qq for pgsql-hackers@postgresql.org; Fri, 06 Sep 2013 19:13:38 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1VI1TG-0001l2-4q; Fri, 06 Sep 2013 15:13:30 -0400 Date: Fri, 6 Sep 2013 15:13:30 -0400 From: Bruce Momjian To: Andres Freund Cc: Alvaro Herrera , Robert Haas , Peter Geoghegan , Tom Lane , Andrew Dunstan , PostgreSQL-development Subject: Re: [PERFORM] encouraging index-only scans Message-ID: <20130906191330.GA13193@momjian.us> References: <20130904205655.GR21874@momjian.us> <20130906001437.GA29264@momjian.us> <20130906020043.GH27195@momjian.us> <20130906052236.GF6067@eldon.alvh.no-ip.org> <20130906130854.GB600952@alap2.anarazel.de> <20130906163056.GA13158@momjian.us> <20130906163647.GA626072@alap2.anarazel.de> <20130906170159.GB13158@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130906170159.GB13158@momjian.us> User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -4.3 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Fri, Sep 6, 2013 at 01:01:59PM -0400, Bruce Momjian wrote: > This December 2012 thread by Andrew Dunstan shows he wasn't aware that a > manual VACUUM was required for index-only scans. That thread ended with > us realizing that pg_upgrade's ANALYZE runs will populate > pg_class.relallvisible. > > What I didn't see in that thread is an analysis of what cases are going > to require manual vacuum, and I have seen no work in 9.3 to improve > that. I don't even see it on the TODO list. OK, let's start the discussion then. I have added a TODO list: Improve setting of visibility map bits for read-only and insert-only workloads So, what should trigger an auto-vacuum vacuum for these workloads? Rather than activity, which is what normally drives autovacuum, it is lack of activity that should drive it, combined with a high VM cleared bit percentage. It seems we can use these statistics values: n_tup_ins | bigint n_tup_upd | bigint n_tup_del | bigint n_tup_hot_upd | bigint n_live_tup | bigint n_dead_tup | bigint n_mod_since_analyze | bigint last_vacuum | timestamp with time zone last_autovacuum | timestamp with time zone Particilarly last_vacuum and last_autovacuum can tell us the last time of vacuum. If the n_tup_upd/n_tup_del counts are low, and the VM set bit count is low, it might need vacuuming, though inserts into existing pages would complicate that. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. + -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers