almost every database engine can use
more then one index to search a table
progress supports this feature since v7
roughly a decade
the process basically scans all the indexes
which are much smaller and faster then reading records
merges the rowid lists
and retreives the records
as for finding the the best indexes
the progress 4gl engine uses a rules-based optimizer
this particular optimizer, geek term
is a syntactical optimizer
from syntax, because the join order i.e. the syntax
stays the same only the indexes are changed
the progress sql engine like any other standard sql engine
supports a cost-based optimizer
only thru odbc/jdbc, not from the 4gl
cost-based optimizer estimate the best access plan
based on various collected statistics
a cost-based optimizer is much more precise
bottom line it's faster
but it also requires maintenance and tunning, generally a dba
which might not be suitable for embedded databases
the obvious problem with rules-based optimizers
is that they're very general
and alot of the time it's pure luck
if they do get it right
all and all, a syntactical optimizer is consideral a solid optimizer
but it's usually suitable for specific searches
and would be a problem with very dynamic criteria
some of the ways around it would be
to use some sort of prefixed ranking of access plans
i.e. if order is entered search by order
else if item is entered search by item
else if group is entered search by group
else don't bother with anything worse then that
just run on the entire query in the most effecient way
i'd also guess that in following releases the 4gl engine
would support the option of using a cost based optimizer
theres no real reason why they shoudn't
a query statement is very similar to a select statement
and they already wrote a working product
some of it could even be used as-is like the stats mechanisms
maybe, after the guys in the engine crew
would free up from all the sql stuff ? please gus !!!
if you're interested
there are tons of material about query optimizers on the web