A database query optimizer determines when no optimal index for a query
exists, determines whether a sub-optimal index exists, and if so, uses
statistical information for each additional key in the sub-optimal index
to rewrite the query in a manner that allows traversing the sub-optimal
index. The sub-optimal index is then probed using the rewritten query,
and the number of estimated returned rows is then used to optimize the
query.