Re: Auto ANALYZE criteria

From: Joe Miller <joe(dot)d(dot)miller(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Auto ANALYZE criteria
Date: 2010-09-21 13:33:00
Message-ID: AANLkTim9VeQUSm8WXVryZkRRvsncWWs+yzK4uOzibGy4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

I was looking at the autovacuum documentation:
http://www.postgresql.org/docs/9.0/interactive/routine-vacuuming.html#AUTOVACUUM

For analyze, a similar condition is used: the threshold, defined as:
analyze threshold = analyze base threshold + analyze scale factor *
number of tuples
is compared to the total number of tuples inserted or updated since
the last ANALYZE.

I guess that should be updated to read "insert, updated or deleted".

On Mon, Sep 20, 2010 at 10:12 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Joe Miller <joe(dot)d(dot)miller(at)gmail(dot)com> writes:
>> The autovacuum daemon currently uses the number of inserted and
>> updated tuples to determine if it should run VACUUM ANALYZE on a
>> table.  Why doesn’t it consider deleted tuples as well?
>
> I think you misread the code.
>
> Now there *is* a problem, pre-9.0, if your update pattern is such that
> most or all updates are HOT updates.  To quote from the 9.0 alpha
> release notes:
>
>         Revise pgstat's tracking of tuple changes to
>         improve the reliability of decisions about when to
>         auto-analyze.  The previous code depended on n_live_tuples +
>         n_dead_tuples - last_anl_tuples, where all three of these
>         numbers could be bad estimates from ANALYZE itself.  Even
>         worse, in the presence of a steady flow of HOT updates and
>         matching HOT-tuple reclamations, auto-analyze might never
>         trigger at all, even if all three numbers are exactly right,
>         because n_dead_tuples could hold steady.
>
> It's not clear to me if that matches your problem, though.
>
>                        regards, tom lane
>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Joe Miller 2010-09-21 14:59:24 Re: Auto ANALYZE criteria
Previous Message Greg Smith 2010-09-21 04:20:39 Memory speed testing