|Subject||Re: SELECT COUNT performance|
Nevermind fixed it. I just checked the index selectivity and it's very low selectivity. When I did the count, I thought the filter used was the primary key (which has a high selectivity) but used a foreign key instead of the primary key.
--- In email@example.com, Doug Chamberlin <dougchamberlin@...> wrote:
> On 7/10/2010 8:14 AM, sqlsvr wrote:
> > 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.
> I haven't seen a where clause in this thread yet.
> What is the SQL used? What is the table schema? What is the selectivity
> on the index? How many records in the table?