Subject [firebird-support] Re: Optimizing a count query
Author Svein Erling Tysvaer
dinol.softedge wrote:
> Hi Kjell
>
> Yes that is twice as fast. It still takes 3 seconds to execute though
> for only 2500 records. It has 3.8 million non-indexed reads to the
> tbl_job_card_employee table even though I have indexed all linked
> fields on tbl_job_card_employee. Any other ideas on how to further
> increase the speed
>
> Thanks very much for your help so far

There can be several reasons for indexes not to be used, one of them is
if you have duplicate indexes - e.g. both a foreign key and a separate
index referencing the same field. Of course, inactive indexes cannot be
used either.

Show us all indexes and keys where TBL_JOB_CARD_EMPLOYEE.JOB_CARD_ID is
a part, as well as statistics for these indexes (very poor selectivity
could possibly explain something as well, but hopefully there are quite
a few different JOB_CARDS in this table). Maybe it also could be helpful
to know which Firebird version you are using.

Set