Re: Number of rows in a table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
Cc: PgSQL Novice ML <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Number of rows in a table
Date: 2003-08-25 20:53:18
Message-ID: 10653.1061844798@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> writes:
> Well yes, but in most other databases, there is a system table that
> stores the approximate number of records in each table, and querying
> that system table is a *lot* faster than sequentially reading a 100M
> row table.

If an approximate number is good enough, see pg_class.reltuples.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Martin Ziebart 2003-08-25 21:07:38 Using PostgreSQL with PHP / Scope an Lifetime of $result
Previous Message Juan Francisco Diaz 2003-08-25 20:30:08 INSERT INTO foo (col1,col2,...,coln) not working