Re: "select count(*) from contacts" is too slow!

From: Ang Chin Han <angch(at)bytecraft(dot)com(dot)my>
To: Christopher Browne <cbbrowne(at)acm(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: "select count(*) from contacts" is too slow!
Date: 2003-10-09 04:17:22
Message-ID: 3F84E152.6090402@bytecraft.com.my
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Christopher Browne wrote:
> A long time ago, in a galaxy far, far away, nolan(at)celery(dot)tssi(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Stark 2003-10-09 05:08:37 Re: "select count(*) from contacts" is too slow!
Previous Message John Wells 2003-10-09 03:42:51 Re: Humor me: Postgresql vs. MySql (esp. licensing)