Subject | Re: [firebird-php] ibase_num_rows instead of count(*) |
---|---|
Author | Lester Caine |
Post date | 2004-09-07T11:46:56Z |
Almond wrote:
no-of-records count, but their COUNT() WHERE X is just as slow.
COUNT(*) has to be slow as it has to count every record visible in the
current transaction.
This has been discussed several times on the general support list. The
best way to do things if you MUST have counts, is to manage them as
tables entries updated via triggers. That way they will very fast to
read, and reflect what you actually want to count. This way you can add
sub-counts as well and do the job properly ;)
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services
> I create a test db and generated 20M record, everything seems ok (?). TheNot a PHP problem - MySQL will start to hit problems soon with its crude
> problem is the count() is very slow. Is there are an ibase_num_rows
> function instead use count() on sql ?
>
> I do some search and found that there is not method to speed up the
> count(), is this correct ?
no-of-records count, but their COUNT() WHERE X is just as slow.
COUNT(*) has to be slow as it has to count every record visible in the
current transaction.
This has been discussed several times on the general support list. The
best way to do things if you MUST have counts, is to manage them as
tables entries updated via triggers. That way they will very fast to
read, and reflect what you actually want to count. This way you can add
sub-counts as well and do the job properly ;)
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services