Re: Seq Scan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kevin Hunter <hunteke(at)earlham(dot)edu>
Cc: Tyler Durden <tylersticky(at)gmail(dot)com>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Seq Scan
Date: 2007-06-01 21:15:04
Message-ID: 23905.1180732504@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Kevin Hunter <hunteke(at)earlham(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ed L. 2007-06-01 21:20:19 Re: query log corrupted-looking entries
Previous Message Frank Wittig 2007-06-01 21:14:44 Re: warm standby server stops doingcheckpointsafterawhile