Re: "select count(*) from contacts" is too slow! - Mailing list pgsql-general

From Ang Chin Han
Subject Re: "select count(*) from contacts" is too slow!
Date
Msg-id 3F84E152.6090402@bytecraft.com.my
Whole thread Raw
In response to Re: "select count(*) from contacts" is too slow!  (Christopher Browne <cbbrowne@acm.org>)
Responses Re: "select count(*) from contacts" is too slow!  (Greg Stark <gsstark@mit.edu>)
List pgsql-general
Christopher Browne wrote:
> A long time ago, in a galaxy far, far away, nolan@celery.tssi.com wrote:
>
>>>MySQL can tell you from it's index because it doesn't care if it gives you the
>>>right number or not.
>>
>>Under what circumstances would MySQL give the wrong number?
>
>
> It would give the wrong number under _every_ circumstance where there
> are uncommitted INSERTs or DELETEs.

Give them some credit. I just double checked:

Using mysql 4.0.14 + innodb and transactions,

select count(*) from foo;

does not count uncommited INSERTs.

Heck, even using myisam, mysql's count(*)'s still accurate, since all
INSERTs, etc are autocommitted.

--
Linux homer 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386
GNU/Linux
  12:00pm  up 287 days,  3:33,  7 users,  load average: 6.93, 6.31, 6.16

Attachment

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Humor me: Postgresql vs. MySql (esp. licensing)
Next
From: Greg Stark
Date:
Subject: Re: "select count(*) from contacts" is too slow!