Re: MVCC and index-only read - Mailing list pgsql-general

From Tom Lane
Subject Re: MVCC and index-only read
Date
Msg-id 22749.1227033982@sss.pgh.pa.us
Whole thread Raw
In response to Re: MVCC and index-only read  (Sam Mason <sam@samason.me.uk>)
Responses Re: MVCC and index-only read
List pgsql-general
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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Slow queries when ORDER BY ... DESC with table inheritance (no index scan backwards)
Next
From: "Joshua D. Drake"
Date:
Subject: Re: Any risks in using FUNCTIONs (stored procedures) instead of raw sql queries?