Re: autoanalyze criteria

From: Stefan Andreatta <s(dot)andreatta(at)synedra(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: autoanalyze criteria
Date: 2013-02-23 18:41:09
Message-ID: 51290D45.30609@synedra.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers


On 02/23/2013 05:10 PM, Jeff Janes wrote:
> On Saturday, February 23, 2013, Stefan Andreatta wrote:
>
>>
> Thanks Jeff, that helped a lot (as did a careful rereading of
> http://www.postgresql.org/docs/9.1/static/monitoring-stats.html
> and
> http://www.postgresql.org/docs/9.1/static/catalog-pg-class.html ;-)
>
> However, to estimate whether autoanalyze should be triggered, I am
> still missing something: the analyze threshold is compared to the
> "total number of tuples inserted, updated, or deleted since the
> last ANALYZE." (according to
> http://www.postgresql.org/docs/9.1/static/routine-vacuuming.html).
>
> pg_stat_user_tables.n_live tup - pg_class.reltuples should give
> something like the sum of rows inserted minus rows deleted since
> the last ANALYZE. But according to the documentation we would need
> the sum of those values. And we are still missing a number for
> rows updated since the last analyze. pg_stat_usert_tables.
> n_dead_tup, on the other hand, is only set back by successful
> VACUUM. autoanalyzing a table with more than 10% dead rows would
> therefore keep autoanalyze in a loop until the ratio rises beyond
> 20% (default configuration) and autovacuum kicks in. So that
> wouldn't make a lot of sense.
>
>
> Hi Stefan,
>
> Sorry, I got tunnel vision about the how the threshold was computed,
> and forgot about the thing it was compared to. There is a "secret"
> data point in the stats collector called changes_since_analyze. This
> is not exposed in the pg_stat_user_tables. But I think it should be
> as I often have wanted to see it.
>
>
> Cheers,
>
> Jeff

Sounds like a very good idea to me - any way I could help to make such a
thing happen?

Stefan

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raymond C. Rodgers 2013-02-23 18:52:58 Re: Dumb question involving to_tsvector and a view
Previous Message Jeff Janes 2013-02-23 16:10:36 Re: autoanalyze criteria

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2013-02-23 19:32:31 Re: make: *** pg_xlogdump: No such file or directory. Stop.
Previous Message Boszormenyi Zoltan 2013-02-23 18:15:06 Re: Strange Windows problem, lock_timeout test request