Subject Re: [firebird-support] Re: SELECT COUNT performance
Author Michael Ludwig
sqlsvr schrieb am 10.07.2010 um 12:14 (-0000):
> Thanks for the response. The resource states:
> Reason is that Firebird doesn't keep information about number of
> records in database. Since query doesn't have WHERE clause, it cannot
> use index either, and has to go through all the records.
>
> But my query DOES have a where clause (it is an indexed column) and it
> is very slow.

What query plan is reported for your query?

\,,,/
(o o)
------oOOo-(_)-oOOo------
SQL> set plan on;
SQL> select count(*) from usr where id = 1;
PLAN (USR INDEX (USR_PK))
SQL> select count(*) from usr;
PLAN (USR NATURAL)

--
Michael Ludwig