Re: Q: is DS 7.x using index?
Posted in 1997
>Query looks like:
>
>
> SELECT * from table WHERE fld > N>
> fld is UNIQUE indexed.
>
> Pls, help, because performance is dead slow.
The use of the index is dependent upon the "selectivity" of that index.
Since the query is an inequality, it is very possible that the index would
not be used because a scan would be actually quicker. Let me explain.
Supposed that it appears that the filter would be selecting in excess of
70% of the total number of rows. If the query were to follow the index,
it is very possible that the index scan would be making multiple selects
on the same page. This would mean that the same page would be "hit"
multiple times during the query. In such a case, it would really make
more sense to sequentially scan the table, even though we might be reading
pages that contained no selected rows. However, this cost would be more
than offset by the fact that each page would only be selected once.
The only way to really know if the index is being used is to check the
output from "set explain on". It is possible that a less than optimal
query plan is being used because the nature of the data has significantly
changed since the last "update statistics" was run.
If it appears that there there are performance is not what is desired, it
might be worth it to contact customer service and open a case for the
problem.
Madison Pruet