Sam Mason <sam@samason.me.uk> writes:
> On Tue, Nov 18, 2008 at 04:49:35PM +0000, Scara Maccai wrote:
>> It makes sense to me,
>> but I don't understand is how other databases (such as Oracle) do it.
> I believe Oracle maintains a separate log (not sure how it's structured)
> that contains this information and all the data in both the main table
> and index can be considered committed.
FWIW, I believe that count(*) is pretty slow in Oracle too. The DBs
that can do it fast are the ones that maintain a centralized counter
of the number of rows in each table. Which makes count(*) nice and
fast, at the cost of horrendous concurrency impacts for updates; plus
there's no chance of real MVCC operation. (In an MVCC world the correct
answer for count(*) can vary depending on who's asking --- there's no
hope of doing that with a single counter.)
regards, tom lane