Re: reltuples < # of rows

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Eric Brown <eric(dot)brown(at)propel(dot)com>
Cc: Postgres help (E-mail) <pgsql-general(at)postgresql(dot)org>
Subject: Re: reltuples < # of rows
Date: 2005-02-23 18:18:41
Message-ID: 20693.1109182721@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Eric Brown <eric(dot)brown(at)propel(dot)com> writes:
> I thought that the number of tuples in a table must be greater than the
> number of rows? For one of my tables, I have the following:
> # analyze t_stats;
> ANALYZE
> siteserverdb=# select reltuples, relpages from pg_class where relname =
> 't_stats';
> reltuples | relpages
> -----------+----------
> 1760 | 21119
> (1 row)

> siteserverdb=# select count(*) from t_stats;
> count
> -------
> 1861
> (1 row)

> How is this possible?

ANALYZE produces only an estimated reltuples. To be exact it would have
to scan the entire table.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joe Maldonado 2005-02-23 19:04:49 view/pgpgsql functions bug
Previous Message javier wilson 2005-02-23 18:14:06 Re: Store procedure -------------- !!!!!!!!!!!!!! URGENTE """""""""""""""