Re: Seq Scan - Mailing list pgsql-general

From Tom Lane
Subject Re: Seq Scan
Date
Msg-id 23905.1180732504@sss.pgh.pa.us
Whole thread Raw
In response to Re: Seq Scan  (Kevin Hunter <hunteke@earlham.edu>)
Responses Re: Seq Scan  ("Tyler Durden" <tylersticky@gmail.com>)
List pgsql-general
Kevin Hunter <hunteke@earlham.edu> writes:
> At 1:17p -0400 on 01 Jun 2007, Tyler Durden wrote:
>> I find strange that a simple SELECT COUNT(...) is so slow with only
>> 700 000 records.

> The much more knowledgable will correct me, but the abbr. version is
> that it is for data integrity and correctness reasons and the
> inherent way in which the MVCC model works.

The bottom line is that a "correct" implementation (ie, one that fully
respects MVCC behavior) would create enormous overhead, as well as bad
contention bottlenecks for concurrent updates.  It doesn't seem worth it.

If you want a cheap approximate answer, there are a couple of ways to
get one, but SELECT COUNT(*) is not that.

            regards, tom lane

pgsql-general by date:

Previous
From: Frank Wittig
Date:
Subject: Re: warm standby server stops doingcheckpointsafterawhile
Next
From: "Alexander Staubo"
Date:
Subject: Re: Slightly OT.