Search Postgresql Archives

Re: Does pg_stat_get_live_tuples() matter?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sherrylyn Branchaw <sbranchaw@xxxxxxxxx> writes:
> If a table has 1.8M rows in reality, yet pg_stat_get_live_tuples() returns
> 1.8K, does it matter to the performance of the database, as long as
> pg_class.reltuples is the right order of magnitude?

Hmmm ... what was in reltuples again?  Looking at the current code,
it looks like vacuum or autovacuum should set reltuples and n_live_tuples
to the same thing.  n_live_tuples gets adjusted incrementally by
subsequent transactions, and it wouldn't be too surprising if it drifted
away from reality, but it's a bit hard to believe that it could get to be
off by 1000X.  Have you suppressed autovacuum on this table?

We have fooled around with the logic that maintains these numbers, so
maybe it was different in 9.6.9.

Anyway, to answer your question, I don't see anything in the current core
code that pays attention to n_live_tuples.  reltuples definitely does
matter to the planner, and some of the sibling counters like n_dead_tuples
drive autovacuum, but nothing is examining n_live_tuples AFAICS.

			regards, tom lane





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux