Обсуждение: Re: [COMMITTERS] pgsql: Clamp last_anl_tuples to n_live_tuples, in case we vacuum a table

Поиск
Список
Период
Сортировка

Re: [COMMITTERS] pgsql: Clamp last_anl_tuples to n_live_tuples, in case we vacuum a table

От
Alvaro Herrera
Дата:
Alvaro Herrera wrote:

> Clamp last_anl_tuples to n_live_tuples, in case we vacuum a table without
> analyzing, so that future analyze threshold calculations don't get confused.
> Also, make sure we correctly track the decrease of live tuples cause by
> deletes.

Now that the values of n_live_tuples and n_dead_tuples are correct,
maybe we should expose them in functions like n_tuples_inserted and all
the rest?  Probably n_live_tuples is not as useful (because you can get
a very similar, if not equal, value from pg_class.reltuples), but
n_dead_tuples seems worthwhile.  I'd also add them to pg_stat_all_tables.

On a loosely related matter, how about changing pg_class.relpages to
pg_class.reldensity?  The idea being that instead of storing the number
of pages, we store the average tuple density, which is what we use
relpages for anyway.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


Alvaro Herrera <alvherre@commandprompt.com> writes:
> On a loosely related matter, how about changing pg_class.relpages to
> pg_class.reldensity?

IIRC, I considered this earlier, and rejected it because it doesn't cope
well with the corner case relpages == 0.  Also, it'll break existing
clients that expect to find relpages and reltuples, if there are any
--- which is not a very strong argument, certainly, but the argument in
favor of changing seems even weaker.
        regards, tom lane


Re: [COMMITTERS] pgsql: Clamp last_anl_tuples to n_live_tuples, in case we vacuum a table

От
"Dave Page"
Дата:

> -----Original Message-----
> From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Tom Lane
> Sent: 27 June 2006 05:12
> To: Alvaro Herrera
> Cc: Hackers
> Subject: Re: [HACKERS] [COMMITTERS] pgsql: Clamp
> last_anl_tuples to n_live_tuples, in case we vacuum a table
>
> Alvaro Herrera <alvherre@commandprompt.com> writes:
> > On a loosely related matter, how about changing pg_class.relpages to
> > pg_class.reldensity?
>
> IIRC, I considered this earlier, and rejected it because it
> doesn't cope
> well with the corner case relpages == 0.  Also, it'll break existing
> clients that expect to find relpages and reltuples, if there are any

There are.

/D