Subject Re: [ib-support] Record Count
Author Paul Reeves
Woody wrote:
> From: "Mike Grover" <mike@...>
> > This is not using IBComponents, ODBC Query, Using a count() means I have
> to query twice :-( , Very time consuming on large queries..
> A Count(*) query should not take that long regardless of the number of
> records. It is performed on the server side so it should return quickly.
Not necessarily. Count has to literally count all the records. It has to do
this because the engine cannot tell which records are visible to the current
transaction without actually visiting each of them. It will be quicker than
actually fetching all the records counted, but it might not feel like it. This
is one of the few downsides of the MGA.

That said, why do you need to do a count? What are you counting? The total
rows in the table, or a subset? Do you know in advance what questions you are
going to ask? And how many users are involved in updating the database?


Paul Reeves
taking InterBase further