Subject Re: [firebird-php] ibase_num_rows instead of count(*)
Author Lester Caine
Almond wrote:

> I create a test db and generated 20M record, everything seems ok (?). The
> 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 ?

Not a PHP problem - MySQL will start to hit problems soon with its crude
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