Re: Spped of max - Mailing list pgsql-general

From Jean-Luc Lachance
Subject Re: Spped of max
Date
Msg-id 3CE26FB7.97AB2704@nsd.ca
Whole thread Raw
In response to Spped of max  (Edmund Dengler <edmundd@eSentire.com>)
Responses Re: Spped of max
List pgsql-general
Neil Conway wrote:
>[...]
> If you don't have a qualification (i.e. SELECT count(*) FROM x), there
> are a couple ways to do it: use triggers to increment/decrement a
> counter of the number of rows in the table, create a btree-indexed
> SERIAL column and do an ORDER BY serial_column DESC LIMIT 1 on it (note
> that this is fragile, your sequence could easily have holes), or if you
> only need an approximation, you could use the pg_class attribute
> "reltuples" for the OID of your table. My impression is that most
> people choose the first method.
>

The real question is:

Why is reltuples only an approximation?

pgsql-general by date:

Previous
From: Evgeniy Strokin
Date:
Subject: XML from postgreSQL tables
Next
From: Andy DePue
Date:
Subject: Is it better to use OS cache or max out memory usage of PostgreSQL?