Re: Slow COUNT

From: Rodrigo Gonzalez <rjgonzale(at)gmail(dot)com>
To: Poul Møller Hansen <freebsd(at)pbnet(dot)dk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Slow COUNT
Date: 2005-12-02 18:02:47
Message-ID: 43908C47.2080406@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

No problem at all.

MyISAM stores the row count in it's header (.frm file).

You can do something like this using a table that has for example
tablename, rowcount.

On the other hand, MySQL with MyISAM does not have row locking, so this
problem is not considered.

Maybe if you tell what you want and why you want to know exact row count
someone can help you

Poul Møller Hansen wrote:

> Rodrigo Gonzalez wrote:
>
>> I answer here so each one can help you.
>>
>> Cannot understand what you mean....index is numbered? Are you talking
>> about "autoincrement" as called in mysql? use sequences please
>>
>
> Sorry, forgot that your email address was in the reply-to field.
>
> I was seeking a solution on how to make a faster count on a lot of rows,
> and I was wondering on the difference between PostgreSQL's and MySQL's
> (MyISAM) of handling counts.
>
> I understand the advantages of MVCC compared to row/table locking.
> And as far as I have understood PostgreSQL count the rows looping
> through all rows, and that's why it takes that long when there are many
> rows.
>
> But how is MySQL (MyISAM) doing it, and why doesn't that way work in
> the MVCC model.
>
>
> Thanks,
> Poul
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2005-12-02 18:03:26 Re: Numeric 508 datatype
Previous Message Poul Møller Hansen 2005-12-02 17:55:34 Re: Slow COUNT