"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