For a compound WHERE clause, ABL builds a logic tree and evaluates index usage on either side of the OR. In general, if all selection criteria on both sides of the OR include matches—equality, range, or sort—on successive, leading components of two non-unique indexes, ABL uses both indexes:
Sample WHERE clause
Indexes used
WHERE Customer.Comments CONTAINS "to*"
OR Customer.Name = "Carlin"
Comments
Name
WHERE Name > "Beaudette"
OR Country > "Zambia"
Name
Country-Post
In addition, if one side of the OR includes a CONTAINS clause (that is, it uses a word index), ABL uses the word index and then a second index to satisfy the other side of the OR:
WHERE Comments CONTAINS "credit"
OR Postal-Code > "01000"
Comments
Cust-Num
In this example, the right side of the OR includes a range match, but Postal-Code is the second component of the County-Post index, so the match is not active. ABL uses the primary index to satisfy this piece of the query and, as always, uses the word index to satisfy a CONTAINS clause as shown in this example:
WHERE Comments CONTAINS "credit"
OR Postal-Code < "01000"
BY Sales-Rep