Consultor Eletrônico



Kbase P20551: Does Progress use multiple indexes in a WHERE clause in SQL?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   25/11/2003
Status: Unverified

GOAL:

Does Progress use multiple indexes in a WHERE clause in SQL?

FACT(s) (Environment):

Progress 9.x

FIX:

There are certain types of queries where SQL92 will use multiple indexes. SQL92 does not use multiple indexes as frequently as the 4GL because of different data access strategies. For various internal reasons, SQL tends to get an entire record, and in this case it is most often cheaper to just evaluate predicates using the record, rather than using another index to check a predicate.

SQL will use multiple indexes when a query has OR'd predicates on multiple indexes, and 1 index is not much quicker than using all. For
example:

select * from customer
where name between 'P' and 'Q'
or city between 'boston' and 'chicago'

[assume indexes on city and on name.]
SQL chooses which indexes to use based on cost estimates, which vary according to database, data distributions, etc.