Subject Re: [firebird-php] ibase_num_rows instead of count(*)
Author Dariusz Zelichowski
I have an application in which I always need to know the
exact number of rows in some (not all) tables. I also found
count(*) to be on a slow side sometimes, although using
count(*) with a WHERE clause against indexed fields should
speed things up.

Regardless, for each table where I need the row count I
created an extra table with one row and one field in it.
The field contains the number of records for one table.
Then I created 2 stored procedures INC_REC_COUNT and
DEC_REC_COUNT. Those are called via a trigger AFTER INSERT
or AFTER DELETE, respectively. Kinda a home brewed solution
but as of now this is the fastest solution I could think
of.


--- Almond <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 ?
>
> Best regards,
>
> Almond Wong
>
>




__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail