Re: [PERFORM] encouraging index-only scans

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Geoghegan <peter(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PERFORM] encouraging index-only scans
Date: 2013-09-07 00:29:08
Message-ID: 20130907002908.GA12753@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

On Sat, Sep 7, 2013 at 12:26:23AM +0200, Andres Freund wrote:
> > 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.
>
> I wonder if we shouldn't trigger most vacuums (not analyze!) via unset
> fsm bits. Perhaps combined with keeping track of RecentGlobalXmin to

Fsm bits? FSM tracks the free space on each page. How does that help?

> make sure we're not repeatedly checking for work that cannot yet be
> done.

The idea of using RecentGlobalXmin to see how much _work_ has happened
since the last vacuum is interesting, but it doesn't handle read-only
transactions; I am not sure how they can be tracked. You make a good
point that 5 minutes passing is meaningless --- you really want to know
how many transactions have completed. Unfortunately, our virtual
transactions make that hard to compute.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2013-09-07 01:23:31 Re: [v9.4] row level security
Previous Message Noah Misch 2013-09-06 23:45:06 Re: Valgrind Memcheck support

Browse pgsql-performance by date

  From Date Subject
Next Message Andres Freund 2013-09-07 05:34:49 Re: [PERFORM] encouraging index-only scans
Previous Message Andres Freund 2013-09-06 22:26:23 Re: [PERFORM] encouraging index-only scans