Re: Number of rows in a table

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: PgSQL Novice ML <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Number of rows in a table
Date: 2003-08-25 17:41:24
Message-ID: 1061833284.11922.65.camel@haggis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Mon, 2003-08-25 at 11:08, paul butler wrote:
> From: "Louise Cofield" <lcofield(at)box-works(dot)com>
> To: <pgsql-novice(at)postgresql(dot)org>
> Subject: [NOVICE] Number of rows in a table
> Date sent: Mon, 25 Aug 2003 10:06:28 -0600
>
> SELECT count(ColumnName) FROM TableName;
> should do the trick

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.

> > I haven't been able to figure out how to determine the number of
> > populated rows in a table - such as "select max(rownum)" in Oracle.

--
-----------------------------------------------------------------
Ron Johnson, Jr. ron(dot)l(dot)johnson(at)cox(dot)net
Jefferson, LA USA

PETA - People Eating Tasty Animals

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Stephan Szabo 2003-08-25 17:50:09 Re: Way to tell what SQL is currently running?
Previous Message Patrick Hatcher 2003-08-25 17:37:24 Re: Way to tell what SQL is currently running?