Subject Re: [ib-support] One line of WHERE clause slows query down
Author Thomas Miller
I haven't been keeping track of Interbase closely, but this use to be
discourage (compound
indexes). I thought that Interbase did not gain anything from them. I
do most of my programming
in Oracle which benefits a lot from compound indexes.

Doug Chamberlin wrote:

> At 06/07/2002 11:50 AM (Friday), Stevio wrote:
> >Why does this line increase the speed of the query so much? Is there
> a way
> >to work around this so that I can still restrict the query to take
> records
> >with a value of 1 but without the query taking so long?
> You probably have indexes on the other fields which you are selecting on.
> That usually helps makes the query go faster. However, your location
> field
> is not very "selective" with respect to your table contents. Even if you
> have an index on the location field, using that index to select specific
> records for a given location value will not result in a small enough
> subset
> for it to be efficient. Therefore, when you add that line the optimizer
> probably concludes it would be faster to just read the whole table to
> determine which records have the matching location.
> You could create a compound index of location plus another field which is
> unique to each record. This compound index would be highly selective and,
> therefore, might be used more efficiently by the query optimizer.
> To unsubscribe from this group, send an email to:
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
> <>.

Thomas Miller
Delphi Client/Server Certified Developer
BSS Accounting & Distribution Software
BSS Enterprise Accounting FrameWork

[Non-text portions of this message have been removed]