Use Indexing for More Efficient Cache Queries

You can index concept and event properties to make searches faster. Use of indexing avoids the need to deserialize the entire object before running the filter—indexing is of greatest value with large objects that have many properties.

You can index more than one of an entity type’s properties. When indexing is used, memory use will also increase.

The efficiency of a filter is increased when you index the properties that are used in the most selective operators (see Optimize WHERE Clause Expressions for details).

Indexing is used for snapshot queries only. The snapshot query manager rewrites parts of the query’s where clause to use Coherence IndexAwareFilters.

The cache provider, however, may or may not use the index, depending on how complex the filter is. Complex where clauses containing function calls and joins will not be optimized. Only simple filters, such as age > 60, or name in (“a”, “b”, “c”), are re-written to use indexes.

For example, indexing the age property for the Customer concept would make the following search more efficient:

select * from /Customer c where c.age > 95

However, indexing would not work for a more complex expression such as the following:

select * from /Customer c where /MyFunctions/roundup(c.age) > 95

You can create the indexes either using Coherence function or domain object override.

To Enable Query Optimization

Only query agents enabled for query optimization use this feature. In the project CDD file, add the following property to the query agent properties:

be.agent.query.enable.filter.optimizer=true

Only agents with this property set to true will attempt to use indexing that you define.