Subject Re: [ib-support] Efficient Record Count
Author Claudio Valderrama C.
""dkLists"" <dklists@...> wrote in message
news:002301c18446$1a328460$03010a0a@gl3...
> All -
>
> I have a large table with approximately 1 million rows that will be
continually
> growing over time. It is useful to be able to review the recordcount
whenever I
> run my app and add/delete data. I've been trying to come up with an
efficient way
> to maintain a 'running' record count without loading the entire dataset to
the
> client, i.e. autofetchall.

The MGA architecture can't be anything for anybody. It would be unbelievable
that it delivered only benefits and none drawback. Here's a drawback: count
is slow. Besides that, you'll better try to understand why you need such
count. Do you need accurate results?

> Would it be much faster to do this in a stored procedure? If so, would it
be as simple as doing a SELECT COUNT(*) FROM TABLE?

No, it has nothing to do with procedures.

> If not, is there a particular IBObjects component that should be used?

IBO is a client-side connectivity package, same than IBX and FibPlus.
Whether IBO has some trick to alleviate your problem in the client side, you
should ask in the IBO list. But first consider why you really need to count
records. What I need sometimes is to count with a tight condition (so I will
get 20 or 50 in return), but not to see if there are 4 or 5 million records
in a table.

C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing