| Subject | Re: [firebird-support] Re: SELECT COUNT performance | 
|---|---|
| Author | Michael Ludwig | 
| Post date | 2010-07-10T13:02:14Z | 
sqlsvr schrieb am 10.07.2010 um 12:14 (-0000):
\,,,/
(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
            > Thanks for the response. The resource states:What query plan is reported for your query?
> 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.
\,,,/
(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