Optimize WHERE Clause Expressions
In the where clause, ensure that the most selective operators appear first.
For example, suppose you have a query like this:
select * from /Customer c where c.location = "CA" and c.age > 95
If the number of customers in the dataset whose age is greater than 95 is very small compared to the number of people living in California, then age > 95 is a more selective operator than location = "CA".
Rewrite the query as follows:
select * from /Customer c where c.age > 95 and c.location = "CA"
The more selective operator now appears first, so the query is more efficient.
Copyright © Cloud Software Group, Inc. All rights reserved.