Re: Help writing a query to predict auto analyze

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Gordon Shannon <gordo169(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Help writing a query to predict auto analyze
Date: 2010-05-19 22:11:35
Message-ID: 1274306950-sup-83@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Excerpts from Gordon Shannon's message of mié may 19 18:02:51 -0400 2010:

> I'm sorry, I'm not following you. Are you saying that "last analysis
> tuples" is "number of dead + live tuples from the previous anlyze"? If so,
> that would really confuse me because X would always be 0:
>
> X = lt + dt - at
> X = pg_stat_user_tables.n_live_tup + n_dead_tup - (n_live_tup + n_dead_tup)
> X = 0
>
> ....or is there something else wrong with the formula?

Hmm? n_live_tup and n_dead_tup corresponds to the current numbers,
whereas "last analysis tuples" are the values from back when the
previous analyze ran. These counters keep moving per updates, deletes,
inserts, they are not static.

If there are no update/ins/del then indeed the difference is 0, which is
why we choose not do analyze.
--

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Yan Cheng CHEOK 2010-05-20 02:44:57 How to insert wchar_t type string to PostgreSQL
Previous Message Gordon Shannon 2010-05-19 22:02:51 Re: Help writing a query to predict auto analyze