Re: number of rows - Mailing list pgsql-novice

From Tom Lane
Subject Re: number of rows
Date
Msg-id 447.1055513524@sss.pgh.pa.us
Whole thread Raw
In response to number of rows  ("Marcus Andree S. Magalhaes" <marcus.magalhaes@vlinfo.com.br>)
List pgsql-novice
"Marcus Andree S. Magalhaes" <marcus.magalhaes@vlinfo.com.br> writes:
> I mean, is there any internal variable that stores the number of
> rows instead of sequencially scanning the entire database??

If a very approximate answer is good enough, you could consult
pg_class.reltuples, which is good as of the last VACUUM.  There
is no on-the-fly maintenance of a row count, for a number of good
reasons that you can read about in the PG list archives.

            regards, tom lane

pgsql-novice by date:

Previous
From: Jeff Eckermann
Date:
Subject: Re: Exporting data from PostgreSQL
Next
From: Josh Berkus
Date:
Subject: Re: Exporting data from PostgreSQL