From: | William Dunn <dunnwjr(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: pg_class.reltuples VS pg_stat_all_tables.n_live_tup for estimation of table |
Date: | 2015-06-17 20:52:37 |
Message-ID: | CAEva=Vm7qD4EVfU+SNwy9TrxTKn03DoaQU97SztAPO55xo2jFw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks so much Tom!
*Will J. Dunn*
*willjdunn.com <http://willjdunn.com>*
On Wed, Jun 17, 2015 at 3:48 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> William Dunn <dunnwjr(at)gmail(dot)com> writes:
> > Does anyone which is a more accurate estimate of a table's live
> > rows: pg_class.reltuples (
> > http://www.postgresql.org/docs/current/static/catalog-pg-class.html)
> > OR pg_stat_all_tables.n_live_tup (
> >
> http://www.postgresql.org/docs/current/static/monitoring-stats.html#PG-STAT-ALL-TABLES-VIEW
> )?
>
> They're both inaccurate with different sources of inaccuracy. I dunno
> that you should assume that one is necessarily better than the other.
>
> > - Is pg_class.reltuples an estimation of live tuples only, or is it of
> > all tuples (both live and dead)? I would guess it's live only but
> that is a
> > guess
>
> Hm. I'm pretty sure the planner takes it as counting live tuples only,
> but it looks like VACUUM thinks it includes recently-dead-but-not-yet-
> removable tuples. We might need to do some adjustment there.
>
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | Миша Тюрин | 2015-06-17 21:14:20 | writable cte triggers reverse order |
Previous Message | Tom Lane | 2015-06-17 19:48:36 | Re: pg_class.reltuples VS pg_stat_all_tables.n_live_tup for estimation of table |