From: | Jean-Luc Lachance <jllachan(at)nsd(dot)ca> |
---|---|
To: | Neil Conway <nconway(at)klamath(dot)dyndns(dot)org> |
Cc: | Doug Fields <dfields-pg-general(at)pexicom(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Spped of max |
Date: | 2002-05-15 14:24:55 |
Message-ID: | 3CE26FB7.97AB2704@nsd.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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?
From | Date | Subject | |
---|---|---|---|
Next Message | Bill Gribble | 2002-05-15 14:56:45 | (security) Rules of thumb for escaping user input? |
Previous Message | Andy DePue | 2002-05-15 14:17:43 | Is it better to use OS cache or max out memory usage of PostgreSQL? |