Bug 40781


GemStone/S 64 Bit,,,,,, 3.1, 3.0.1, 3.0,, 2.4.5,,,,,,, 2.4.4, 2.4.3, 2.4.2, 2.4.1, 2.4,, 2.3.1, 2.3,,,,, 2.2.5, 2.2.4, 2.2.x, 2.2, 2.1.5, 2.1.4, 2.1.x, 2.0.x, 1.2.6, 1.2.5, 1.x


Performance of ordering on multi-predicate indexed queries

When performing a multiple predicate indexed query, for the best performance,
the predicates should be ordered so that the most restrictive predicate
is evaluated first.  Predicates are evaluated from last to first (not the
intuitive evaluation order), so the most restrictive predicate should be
last in the query code.

For example, in the following query
  AllCustomers select:
    {:customer |
    (customer.status==#valid) & (customer.lastName=aName)}

The query predicate on lastName is performed first, resulting in a much
smaller set that the second predicate must perform the query over.


Please examine your existing multi-term queries to ensure the ordering
is optional for performance.  Note that the ordering has changed in 3.0,
so you should reexamine your predicate terms for performance after upgrading
from 2.x to 3.x.

Last updated: 1/15/14